I'm trying to sync my local drive with an external hard drive using rsync and I want it to only copy new and updated files. Additionally, I need it to remove files from the destination if they've been removed from the source. I initially used the `-avP` command but it seems to copy everything again, which makes the process much longer than I would like. I'm using Debian 13 for this backup. How should I structure my command to achieve the desired incremental backup?
4 Answers
If you're seeing everything copied again, it might be due to differences in file permissions or timestamps. Use the same path formatting on both sides, including trailing slashes. Try `rsync -avhsP --delete /source/path/ /destination/path/` and consider running it with a dry-run using the `--dry-run` option first to verify it will do what you expect.
Just a tip: If you have a large amount of data to transfer, including exclusions for items like your system's trash can can save you some time. For example, you might do `rsync -avhsP --delete --exclude=.Trash-1000 /mnt/media/ acer3:/mnt/media/`.
You can simplify your command to `rsync -av --delete /path/to/source/ /path/to/destination/`. This way, it will only copy new or updated files from the source and also remove files from the destination that no longer exist in the source.
Make sure you use the `-u` option as well, which tells rsync to skip files that are newer on the destination. It's a good way to ensure you're only syncing what's necessary.

Related Questions
Can't Load PhpMyadmin On After Server Update
Redirect www to non-www in Apache Conf
How To Check If Your SSL Cert Is SHA 1
Windows TrackPad Gestures