brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: rsync --ignore-existing never touches a file that is already at the destination

Backup
~/tips/tip-rsync-ignore-existing

rsync -av --ignore-existing photos/ nas:/photos/

Skips every file that already exists on the receiving side, even if the source copy is newer.

Some copies are add-only. I have a folder where new files should arrive and old ones should stay exactly as they are. rsync has an option for that.

rsync -av --ignore-existing photos/ nas:/photos/

Any file that exists on the receiver is skipped. Directories are not skipped, so rsync still walks into them and copies the new files it finds. The manual also mentions it as a way to resume an interrupted --link-dest backup.

The catch is obvious once you say it out loud: a file that changed on the source will not be updated at the destination, because the name already exists there. Use this for add-only folders, not for a mirror.

It is a transfer rule as well, so it has no exclude side effects, and it only checks files already in the destination hierarchy. Combine it with -n if you want a preview of what would be added.

A neat pairing is an interrupted copy: run the same command again, and files that already made it across are skipped without rsync comparing them. The manual only recommends it for resuming an interrupted --link-dest backup, so I’d keep it to that and to add-only folders.

Further reading: rsync manual

More Backup tips restic snapshots --group-by host,paths mysqldump --routines --events mydb > mydb.sql rsync -a --files-from=list.txt /home/me/ backup:/backup/ restic find "*.txt" restic stats All Backup tips (45) All topics

Link