mikeobrien / grunt-robocopy

Grunt task for running robocopy.
MIT License
2 stars 5 forks source link

Leading backslash getting chopped when passing destination as parameter #3

Open ghost opened 10 years ago

ghost commented 10 years ago

I have a build & deploy script that determines the source & destination paths based on an user-provided environment flag (dev, qa, beta, prod). The destination path is always one or more network shares, such as \foo.bar.com\inetpub\dev

At the end, my script calls the grunt-robocopy task, passing the constructed source and destination paths. However, for some reason, the very first backslash is being trimmed when this executes, there-by copying the contents to a folder off of my root C: drive instead of the network share folder

I have tried both running the robocopy task directly from the command line, and as part of my overall build/deploy script, and the result is the same.

You can see from the following example that the leading double-backslash is visible in the first logging message, but not in the actual call to robocopy. Also, I do no believe this is an escaping issue, as other backslashes later in the destination path (both single and double) are emitted properly. If I run the robocopy command manually in DOS using the uncorrupted destination path, it works perfectly.

grunt robocopy:exec:build/dev:\foo.bar.com\InetPub\dev Running "robocopy:exec:build/dev:\foo.bar.com\InetPub\dev" (robocopy) task robocopy "build\dev" "\foo.bar.com\InetPub\dev" "." /mir /r:3 /w:15


ROBOCOPY :: Robust File Copy for Windows

Started : Sun Jul 27 15:34:54 2014 Source : C:\MyProjects\MyWebsite\build\dev\ Dest : C:\foo.bar.com\InetPub\dev\ Files : .

Options : . /S /E /COPY:DAT /PURGE /MIR /R:3 /W:15

Here are my GRUNT config options (in coffeescript) for the robocopy task: _robocopy = exec: options: source: '<%= grunt.task.current.args[0] %>' destination: '<%= grunt.task.current.args[1] %>' copy: mirror: true retry: wait: 15, count: 3

Please advise if this is something you can fix.

Thanks!

mikeobrien commented 10 years ago

I'm going to be off the grid until next week so I won't be able to look into it. I do accept pull requests tho, so if you come up with a fix I can try to get that out ASAP.

AntSwift commented 8 years ago

A workaround is to use forward slashes instead. E.g. //server/share/folder/