Ubuntu – How to substitute colons when I rsync on a USB key


I would like to backup my mail directory on a USB key. However, my IMAP has a strange naming convention that something include a colon (:) character. Since the USB is in a window format, rsync fail to create those file. Is there a way to replace the colon character by an underscore when running rsync? (Or to do the same synchronization with another tool?)

Just a few point that I clarified in the comments :

  • This is a worst case scenario backup, I would like to be able to read it on a windows machine without installing anything.
  • I got a lot of data that stay constant. So I save a lot of time if I have a tool that just copy the newer files.
  • I am not looking for a rewrite of rsync. I am looking for a existing tool that can be used out of the box.


Best Answer

  • Use rdiff-backup instead of plain rsync. It will automatically detect and substitute for characters that aren't supported on the destination disk, and also put them back as they were when you restore to a unix filesystem. It produces an unpacked directory that looks just like the origin plus one extra metadata directory.