System Administration
cancel
Showing results for 
Search instead for 
Did you mean: 

rsync is not deleting directories.

 
SOLVED
Go to solution
Timothy P. Jackson
Valued Contributor

rsync is not deleting directories.

Hello,

I am usings rsync between to local directories but it does not want to delete directories that no longer exist on the source. Here is the command that I am using.....

rsync -avcu --delete --stat /dir1/* /dir2/

What am I doing wrong or missing?


Thanks,
Tim
2 REPLIES
Thierry D
Valued Contributor
Solution

Re: rsync is not deleting directories.

Hi Timothy,

you should try with the "--force" option after "--delete" then it should work.

Regards,
Thierry
Timothy P. Jackson
Valued Contributor

Re: rsync is not deleting directories.

Thanks for the response Thierry!

Even after using the --force it still didn't want to work correctly. I finally found the problem. Here was my command....

rsync -avcu --delete --stat /dir1/* /dir2/

The problem was the "*" after the /dir1/ rsync will not delete directories directly under /dir2/. It will delete any sub directories. I removed the "*" and that fixed the problem.