0

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.

Jeff Schaller
  • 67,283
  • 35
  • 116
  • 255
natevw
  • 184

0 Answers0