I am trying to synchronize the content of the directory my_dir/ from /home to /backup. This directory contains a file which name has a double quote in it, such as to"to. Here is my rsync command:

rsync -Cazh /home/my_dir/ /backup/my_dir/

And I get the following message:

rsync: mkstemp "/backup/my_dir/.to"to.d93PZr" failed: Invalid argument (22)

For info, rsync works well when the synchronized filenames contain single quote, parenthesis and space. Thus, why is it bugging with a double quote? Thanks for any help.

  • What's the version of both rsyncs? Jan 29, 2011 at 1:36
  • rsync version 3.0.7 protocol version 30 (on Ubuntu 10.04 Lynx Lucide)
    – tflutre
    Jan 29, 2011 at 10:13

3 Answers 3


In fact, it happened that the directory /backup/my_dir/ was on a USB hard-drive formatted in FAT. Rsync developpers told me that it was this filesystem that doesn't allow double quotes in filenames. After reformatting my USB hard-drive into ext3, rsync worked smoothly, even with filenames containg double quotes.

  • Same thing here. For me it was a bunch of files that had a colon (:) in the file name. I just renamed them using the top answer from commandlinefu.com/commands/view/8374/… and was good to go.
    – Ciske
    Aug 1, 2013 at 8:19

This seems to be a bug in rsync, where you cannot do much about it. Feel free to report it to the rsync developers.

One solution would be to rename all files with double quotes in them. They shouldn't be there in the first place anyway.

  • 1
    Why shouldn't they? Jan 29, 2011 at 3:45
  • The files with double quotes in their names are taken from MusicBrainz when importing my CDs into Rhythmbox. Therefore I don't want to rename all of them... As you suggest, I will report the bug.
    – tflutre
    Jan 29, 2011 at 10:15
  • 1
    @tflutre : usually bug reports in Linux are ignored. After 6 years, this is still a bug in rsync. Apr 2, 2017 at 18:04

Have you tried using the octal representation of the double-quotes (i.e. \042). I am not sure if rsync supports it, but it's worth a try.

  • The OP isn't specifying the filename, rather only the containing folder. Jan 29, 2011 at 3:45
  • Indeed, but this doesn't invalidate my suggestion! He mentions that he has one file with double-quote in this directory, so he could just issue a separate command to sync this file (if my suggestion works). Let's just let the user judge to what extent this workaround would fit his need. Jan 29, 2011 at 9:56
  • I answered above to Martin Scharrer why I won't rename all my files, but thanks anyway.
    – tflutre
    Jan 29, 2011 at 10:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.