All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
rsync help for deleting files after sync
Hi,
I have been using rsync for a while to transfer backup to remote server , however today I noticed that DESTINATION is also keeping files those are deleted on SOURCE.
Say SOURCE had files
1.sys
2.sys
3.sys
4.sys
Then it was rsynced with DESTINATION , now both have similar files..
However issue is coming when :
I deleted 2.sys and added 5.sys and 6.sys, then on SOURCE It will be
1.sys
3.sys
4.sys
5.sys
6.sys
When rsynced with DESTINATION, it now contains all :
1.sys
2.sys
3.sys
4.sys
5.sys
6.sys
But I want to delete the files those are also DELETED on SOURCE:
I am using following command with --delete parameter.. still no luck:
rsync -avzh -e 'ssh -p 8011' --delete --progress user@SOURCE:/home/all-bacups/* DESTINATION/dir
Is it something I am missing ?
Comments
--delete is enough. Must be some other problems...
Try moving the ssh portion to the back like this:
rsync -avzh --delete --progress -e 'ssh -p 8011' user@SOURCE:/home/all-bacups/* DESTINATION/dir
Was earlier doing that way only
There is no error or output or something like that.. how to figure it out ?
My bad.
You should copy the directory into the new place, instead of copy each separate files.
Thus, try
rsync ...... source/all-backups/ dest/dir
When you use the star
*
, it will be expanded to separate individual files, and thus extra files are not deleted because they are not included in the list at all!All you need is the "--delete" option and it has to work.
The reason I said to move it to the end is because that is the way I run rsync and it works for me that way.
Have you tried it without the quotations around the ssh portion?
I just realized your command includes the "h" option for help.
Try removing it, there should be no reason to have it there.
-h, --human-readable output numbers in a human-readable format
The man page I saw had the "h" for help.
Nailed.. that is logical and actually worked too
Thanks..
I donno why I added it there, may be du -sh (human readable stuff) .. but indeed its -h for help here.. removed it.
facepalm Actually -h appears before both human-readable and help. But it works as human-readable, at least on version 3.1.