3

I have a huge number of small files to rsync to a Windows machine. Most of them transferred just fine, but every file with a colon couldn't be transferred because the filename is invalid on Windows.

Is there any practical hack-around that I could use to get those files regardless? For example, some rsync setting or some filename-escaping script that I could pipe rsync through?

RomanSt
  • 1,207
  • 1
  • 15
  • 32
  • Where is it bombing out? On another Windows box or Linux box? Escaping reserved characters in a Windows shell is `^` IIRC and if you are using Linux, I believe it is `\\\`. I could be wrong. – songei2f Feb 04 '11 at 14:12
  • @alha the errors occur on the Windows box, which is the destination of the copy. For the record, rsyncd is running on the remote, Unix box; Windows is running a cygwin-based rsync port. – RomanSt Feb 04 '11 at 14:13
  • Well I am not sure then. Clearly the Windows shell/command prompt escape character will not help. You are probably looking for the \ character (I kept trying to put in a fscking code block, but it does not format properly. – songei2f Feb 04 '11 at 14:15
  • The character in the title of your question is called a "colon". This is a semicolon `;`. – Dennis Williamson Feb 04 '11 at 15:33
  • @Dennis fixed, thanks. I know what it's called but inexplicably I keep writing "semicolon" when I mean "colon". – RomanSt Feb 04 '11 at 15:35
  • My fingers have minds of their own, too. – Dennis Williamson Feb 04 '11 at 15:50

2 Answers2

2

No, because the : is an invalid filename on Windows, rsync can't store it there since the OS will prevent it. You will have to rename those files.

Sven
  • 98,649
  • 14
  • 180
  • 226
  • 1
    OK, let's leave Windows out of this for the sake of argument. Is there no way for me to remove colons from filenames when rsyinc'ing from one unix box to another unix box? I'm certainly not an expert, but my overall impression is that Unix is really good at this sort of thing. – RomanSt Feb 04 '11 at 14:51
  • 2
    Might want to look at this answer - http://serverfault.com/questions/57176/using-rsync-to-rename-files-during-copying-with-files-from/57218 – dsolimano Feb 04 '11 at 15:09
1

You can install Windows Services for Unix/Subsystem for Unix-based Applications and run rsync on there, which will allow you to create files with : in them, or named CON, or whatever else you want. However, that may not be terribly useful, as you will only be able to access the files from other SUA applications, not regular Win32/Win64 apps. What are you trying to accomplish?

If you end up going this route, you should probably enable NTFS case sensitivity as well.

dsolimano
  • 1,320
  • 2
  • 14
  • 26
  • I need to process these files with certain tools on Windows. Rather than trying to figure out how to do the same thing on Unix, I thought I'd just copy the files. But then it turned out that some of them have colons in filenames. – RomanSt Feb 04 '11 at 15:09