1
rsync -av --del ~/ /media/m/USB\ Stick/kopia/rsynclinux/

For reasons unknown I was living in a false impression that once I remove a file from home directory in source the file would be removed in destination as well.

I had to reinstall and restore the backup... only to find how wrong I was. I now have an incredible mess of obsolete & duplicated files!!

Well I won't travel back to the past to make a proper backup, instead I'm stuck with slowly, ardously bringing order to my old notes.

But at least I want to avoid such mistakes in the future. Why does this call to rsync fail to delete files?

Note I read this: rsync doesn't delete files in destination directory But as U can see my call to rsync does not include a wildcard so the two problems are not the same

2 Answers 2

1

The --del option is an alias for --delete-during. The option you were looking for is --delete.

There's a good summary of the different options at https://superuser.com/questions/156664/what-are-the-differences-between-the-rsync-delete-options.

1
  • The --delete-during (i.e. --del) implies --delete, and has done since it was first added in 2.6.4 (30 March 2005) Jul 18, 2023 at 12:47
0

If /media/m/USB\ Stick/kopia/rsynclinux/ is a FAT-based or NTFS filesystem it cannot store all the attributes (metadata) for files copied from a native-Linux filesystem. This will trigger rsync into considering there has been an error copying the files, and the --delete will be disabled.

From the documentation, man rsync, under --delete (implied by --del or --delete-during):

If the sending side detects any I/O errors, then the deletion of any files at the destination will be automatically disabled.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .