I can use the same paths for filecopy or filemove and have no problem but I need to use robocopy because I want to move protected macrium image files. At cmd prompt I tried robocopy /? and it seems Ok but I can't get it to actually copy anything. Can anyone suggest a way to fix it or approach to test it? Thanks.The filename, directory name, or volume label syntax is incorrect.
OT Trying and failing to get robocopy to work Topic is solved
- PuzzledGreatly
- Posts: 1303
- Joined: 29 Sep 2013, 22:18
OT Trying and failing to get robocopy to work
I've tried runwait robocopy and runwait %COMSPEC% /c Robocopy but neither works. I tried using robocopy directly from cmd but also got an error:
Re: OT Trying and failing to get robocopy to work Topic is solved
You did not specify your file paths in your post, and that appears to be the problem, according to the error message. The following test worked for me. If you do not have permission to the directory, it would probably fail. You could try running as admin, or removing the trailing backslash from your file paths. Since Robocopy generates an ErrorLevel, it may also be informative.
Code: Select all
source = e:\data\temp2\t\t2
target = e:\data\temp2\t\t3
err := {16: "***FATAL ERROR***" , 15: "OKCOPY + FAIL + MISMATCHES + XTRA"
, 14: "FAIL + MISMATCHES + XTRA" , 13: "OKCOPY + FAIL + MISMATCHES"
, 12: "FAIL + MISMATCHES" , 11: "OKCOPY + FAIL + XTRA" , 10: "FAIL + XTRA"
, 9: "OKCOPY + FAIL" , 8: "FAIL"
, 7: "OKCOPY + MISMATCHES + XTRA", 6: "MISMATCHES + XTRA" , 5: "OKCOPY + MISMATCHES"
, 4: "MISMATCHES" , 3: "OKCOPY + XTRA" , 2: "XTRA"
, 1: "OKCOPY" , 0: "No Change"}
RunWait, Robocopy "%source%" "%target%",, Hide
MsgBox, 64, ErrorLevel = %ErrorLevel%, % err[ErrorLevel]
- PuzzledGreatly
- Posts: 1303
- Joined: 29 Sep 2013, 22:18
Re: OT Trying and failing to get robocopy to work
Thanks, Mikey, for such a thorough reply. I tried the following:
And got Errorcode 16. However if I try this cmd code it worked (copying all the txt files and excluding the mrimg files):
Error code 16 is fatal error. Seems I can't get robocopy to work with ahk.
Code: Select all
source := "X:\Images W10"
target := "m:\test"
Runwait, Robocopy, "%source%" "%target%" /xf *.mrimg
MsgBox, 64, ErrorLevel, %ErrorLevel%, % err[ErrorLevel]
Code: Select all
robocopy "x:\images w10" "m:\test" /xf *.mrimg
Re: OT Trying and failing to get robocopy to work
Use my format: no comma after the command. Why? AHK uses commas to identify its own parameters. Your command-line format also has no comma!
- PuzzledGreatly
- Posts: 1303
- Joined: 29 Sep 2013, 22:18
Re: OT Trying and failing to get robocopy to work
Thanks , Mikey, I didn't notice the comma and it makes all the difference!. With that change I got error code 1, which means it worked.
Re: OT Trying and failing to get robocopy to work
Without the comma, it all goes in the first parameter of RunWait (Target) which means you’re running robocopy and passing those arguments to it as you would when typing them into a CMD window, With the comma, you’re putting what follows it in the second parameter of RunWait, which is the working directory.
Who is online
Users browsing this forum: No registered users and 287 guests