Wednesday 22 June 2016

Robocopy

Robocopy is remarkably different from other copy commands. It is often used in msbuild projects but there are a bunch of caveats which would appear non-intuitive to a first time user. The reason people consider using it is because it allows retries and after parameterised wait intervals.

The default syntax of robocopy takes folders as parameters and copies source folder to destination. To copy a file, the syntax is the following:

robocopy C:\source C:\destination filename.ext

Notice that filename is not part of the source here. Also, because of this limitation a file can not be copied to another location with a different name. Due to this, in msbuild projects, you need to copy the file using robocopy (assuming you use robocopy) and then rename it.

No comments: