Tuesday, 3 September 2013

Robocopy command line - file with spaces

Robocopy command line - file with spaces

I am trying to run the following command:
robocopy.exe <fromdir> <todir> file.cfm new file 3.cfm /mir
/log:#path#\cfeis\mysync2\logs\rc_090313.txt /NDL /r:2 /w:2
This works fine as long as there's no space in any of the file names. But
if one of the file names has a space it sees everything after the first
space as the next file. IE, for the above it would say:
Files : file.cfm new file 3.cfm
I've tried using quotes, forward and backward slashes and brackets around
all the files, and around only the file with spaces. Also if the file is
in a folder with spaces and also has spaces (something like new folder\new
file.cfm) it errors.
Error : Invalid Parameter #5: "folder\new"
Can anyone give me the correct syntax for dealing with spaces in the
folder and/or file name?

No comments:

Post a Comment