parameters - RoboCopy - Files starting with a dash result in error -
we in process of migrating files 1 share another. have built tool in user can select directories and/or individual files copied destination share. tool generates individual robocopy command each of files or directories in collection results selection made user.
we having problems if individual file copied starts dash, instance:
robocopy c:\temp c:\temp2 -a.txt
robocopy bails out with: error : invalid parameter #3 : "-a.txt" tried usual suspects (quotes around filename etc.), far nothing seems work. idea how around this, without resorting renaming file prior copying?
this appears bug in robocopy; has other known similar ones:
https://support.microsoft.com/en-us/kb/2646454
here's possible workaround:
robocopy c:\temp c:\temp2 *-a.txt /xf *?-a.txt
*-a.txt
still match "-a.txt", matches "x-a.txt", "xx-a.txt", etc.
the /xf
file exclusion knocks out "x-a.txt", "xx-a.txt", , other file characters (specifically, @ least 1 character) in front of hyphen.
i've confirmed above command match "-a.txt" if c:\temp
contains these files:
other folder\-a.txt -a.txt1 -a1.txt x-a.txt xx-a.txt
i'm not 100% confident though, might want think other filenames test against.
Comments
Post a Comment