I am merging two folders with the following command:
rsync -a --checksum --backup --suffix=.merge-bkup src/ dst/
The idea is that if a file exists in both folders, both versions are preserved.
However, I am doing this on an operating system with a UI that uses extensions to associate files with applications. So while it may technically preserve both "My File.txt" and "My File.txt.merge-bkup" the latter file will not be useful to many users since it can no longer be opened automatically in the right application.
Can I use find
to somehow take every file named "My File.txt.merge-bkup" and rename it to "My File (Backup).txt"? Even better would be to end up with "My File (Backup N).txt" if "My File (Backup).txt" already exists but I suspect that might be a stretch.
mv My\ File.txt.bkup My\ File\ Backup.txt
;-) – natevw Jul 06 '18 at 18:48--backup-dir
option of rsync to ask it to preserve the original file names, but move them to a different directory. – Lucy Maya Menon Jul 07 '18 at 19:01