Ok, so i think your problem is with -b
option. From man:
-b, --backup
With this option, preexisting destination files are renamed as each file is transferred or deleted. You can control where the backup file goes and what (if any) suffix
gets appended using the --backup-dir and --suffix options.
Note that if you don’t specify --backup-dir, (1) the --omit-dir-times option will be implied, and (2) if --delete is also in effect (without --delete-excluded), rsync
will add a "protect" filter-rule for the backup suffix to the end of all your existing excludes (e.g. -f "P *~"). This will prevent previously backed-up files from being
deleted. Note that if you are supplying your own filter rules, you may need to manually insert your own exclude/protect rule somewhere higher up in the list so that it
has a high enough priority to be effective (e.g., if your rules specify a trailing inclusion/exclusion of ’*’, the auto-added rule would never be reached).
Whenever you sync your files, it will sync them again, and it will put ~
sufix after the old file name (file~).
I don't know what is your end goal, but if you just want to bakup ~/Desktop/files/
use this:
rsync -avP ~/Desktop/files/ /media/myDrive/
If you want to be exact match (deleting the files that are not in ~/Desktop/files/ anymore {i think that is what you are looking for}):
rsync -avP --delete ~/Desktop/files/ /media/myDrive/
*-P same as --partial --progress
rsync
to do what you want is an art, not a science. You might want to useav
and look into--delete
. You definitely want to test with--dry-run
until you get it right. For example, the trailing slash on a path is different than without. Also, ensure the target timestamps are valid, especially if the target is a network mount or a different filesystem (like FAT32).rsync
to tell you what it's doing with each file with the-i
flag. Since it looks like your doing it onto another filesystem, maybe rsync is just updating the permissions, or the timestamps. It really depends on the filesystem in/media/myDrive
. Post the first few lines of the itemized output if you don't understand it.