I run the following daily crontab:
rsync -e 'ssh -p xx' -ab --inplace --delete myname@domain.com:/home/myname/backup/ /media/internal/myname/backup/
It creates these files:
-rw-r--r-- 1 myname myname 432M Oct 1 00:01 monthly-db-backup.tar.gz -rw-rw-r-- 1 myname myname 431M Sep 1 00:00 monthly-db-backup.tar.gz~ -rw-r--r-- 1 myname myname 74 Sep 27 10:08 monthly.py -rw-rw-r-- 1 myname myname 74 Aug 24 2017 monthly.py~ -rw-r--r-- 1 myname myname 1.5M Oct 11 00:00 domain.sql -rw-r--r-- 1 myname myname 1.5M Oct 10 00:00 domain.sql~ -rwxr--r-- 1 myname myname 8.0K Sep 27 10:18 sessionbackup.db -rwxrw-r-- 1 myname myname 8.0K Jun 5 2019 sessionbackup.db~
Anyone know why it creates these tilde (~) files? Also anyone know a quick way to delete them?
Advertisement
Answer
Anyone know why it creates these tilde (~) files?
That would be because of the -b
option you are specifying to rsync
. Its purpose is to request exactly that (creation of backup files for destination files that are being replaced).
Also anyone know a quick way to delete them?
If there is no subdirectory structure to deal with (for example, if you have presented the full list of files), then
rm /path/to/the/directory/*~
would be sufficient. If you need to clean up backup files in subdirectories of that directory, too, then
find /path/to/the/directory -name '*~' -delete
would handle it.