If the file in the source has been deleted since the last run of the job, the same file in the target will be deleted automatically as well. If the file in the source is newer, it will overwrite the file in the target. However, when it runs the next time (I usually set it to run daily after business hours), it will look at the source and compare it to the target, and if the file has not changed, it will not do anything with it. With this in mind and with the above parameters, the first execution of the job will take a while as it has to do the initial copy of all the data. I usually create a scheduled task to run a batch file that includes the Robocopy lines to run. I don’t usually just run Robocopy once and be done unless I’m copying inactive stale data. This is the second place where Robocopy really shines. Furthermore, why would I want to delete a file that never existed in the first place. The question arises here of if the file or folder no longer exists in the source location, why would I be trying to copy it to the target. Note that technically, using parameters /e and /PURGE together gives the same effect as using one parameter by itself (/mir – for “mirror”), but I prefer having a big capital “PURGE” in the syntax so when I look at it, I know I am likely deleting something. This parameter deletes destination files and folders that no longer exist in the source. That way, there isn’t a new timestamp, or owner, or inherited NTFS permissions when there shouldn’t be, etc. So you may have been asking yourself, why all the hassle? Why not navigate to both location and copy-paste the files from location to location? This parameter copies all file info.
#Emcopy flags windows#
This doesn’t create a VSS snapshot, but instead, this is useful if the Windows account you are running Robocopy with may not have complete access to the source location due to ACLs in NTFS. If it only copied the files in the top-level shared folder, it would not be of much value. This is where the true value of Robocopy comes into play. This copies subdirectories, including Empty ones. The next parameters don’t need to be in any particular order. There are multiple advantages to that I have found over the years. I also like to create a root folder called “Shares” and put all the shared folders into this folder instead of leaving them at the root. I highly encourage you to not put these on the C:\ operating system volume whenever possible. The second parameter is always the destination location. I will not likely have the shares built yet on the new server.It will likely have a newer version of Robocopy installed and.I typically always run Robocopy from the new file server as: The first parameter is always the source location. Over the years of usage, I have found this syntax the one I keep going back to over and over again: Be careful with some of the options if you are just trying it out, as some of them move the data (deleting the files and folders in the source location or the target location). There are quite a few options when it comes to file server migrations using Robocopy, and you might not know where to start.
#Emcopy flags how to#
So, chances are if you start a command prompt on your computer and type “robocopy /?” you’ll see the help dump of information to your screen on how to use the utility.
Beginning in 2008 (and thereafter), it was bundled with both desktop and server operating systems starting with Vista and Server 2008. Back then and until 2008, it was available with the Windows Resource Kit download. Robocopy has existed since NT4 days in 1996, so this is likely not the first time you are hearing of it. When the need arises to duplicate the data for the migration to the new server, I always go back to old faithful- Robocopy (Robust File Copy for Windows).
However, this process only works elegantly when the file share data exists on a volume that isn’t where Windows or any applications are installed. It is also generally very quick as there is no need to copy terabytes of data from one server to another. This maintains NTFS permissions if both servers are members of the same Active Directory domain. Sometimes if the server doesn’t have any other roles or functions installed other than just a file server, then I could simply unshare the shares on the original server, detach the virtual hard disk from it, attach the virtual hard disk to the new server, and reshare the shares. With various flavors of Windows Server operating systems going out of support this year, I have found myself with a decent number of file server migrations from one system to another.