Does Rsync Delete Files?

Does Rsync Delete Files?

In its simplest form, the rsync command will copy files from the file source to the file destination. It will not remove files on the destination side that aren't on the source and it won't recreate all of the metadata (e.g., ownership and group details) unless your rsync command includes just the right set of options.

What does rsync delete?

--delete This tells rsync to delete extraneous files from the receiving side (ones that aren't on the sending side), but only for the directories that are being synchronized. ... 7, deletions will also occur when --dirs (-d) is enabled, but only for directories whose contents are being copied.

Is rsync destructive?

Be careful. One final recommendation: rsync can be a destructive command. Luckily, its thoughtful creators provided the ability to do "dry runs." If we include the n option, rsync will display the expected output without writing any data.

Robert Thorne
Author

Robert Thorne

Robert Thorne covers electric vehicle innovations, autonomous driving systems, global mobility trends, and automotive engineering developments.