Task of the day: Move a file using robocopy

A few days ago, I observed something is wrong in the workflow of a unit in a different department. Their workflow requires retrieving a video through FTP and then moving the files to another folder to be transcoded. The process of moving files from a folder to another is currently done manually. This method is not efficient nor proper.

 Problem

There are some issues with their workflow. First, The unit has to perform the process manually, which is a distractive subtask for them. Moreover, the unit does not have any log for the process. Lastly, the files do not have specific arrival times.

The solution: Robocopy

 

 

Screenshot of Robocopy script
Robocopy Syntax

 

A file replication solution solves The unit’s issue. There are many solutions that can be used, but for them I chose Robocopy.

According to Wikipedia, it a command line files and/or folder files replication developed by Microsoft. It is a replacement for Xcopy and it has additional options.  Robocopy allows copying, moving files and folders inside Microsoft Environment. Also, it allows to create a list of files moved or copied and when.

Below, the Robocopy syntax used to fix this issue.

 

 robocopy C:\Source C:\Destination *.* 

 

The upper syntax will just copy all files in the source folder to the destination folder. However, the syntax does not keep a log of all copied files. Robocopy does provide a method to keep a log of all copied files. The below syntax shows how to do so.

 robocopy /log+:"C:\Logs\logs.txt" C:\Source C:\Destination *.* 

/log lets the solution save the operation logs into a certain file. In this example, robocopy saves log file in logs.text appended. It is important to monitor and log every service because it allows system administrations know more about the service when it fails to work properly.

Hemo’s Take

There are many ways to solve this problem. However, I chose this approach because I find easy to understand and implement. Moreover, Robocopy can be used as a part of your backup Strategy.