I used Robocopy to copy some data to an area, then used Robocopy to copy data from an older area to fill in the gaps in the folder structure. A number of earlier files overwrote their later versions with the same filename. What happened?
By default, Robocopy lets an earlier file overwrite its later version. Be sure to use the /XO (excludes older files) option if you want to prevent later files from being overwritten.
Our management team wants me to divide a folder structure and move it to 50 servers and folder locations. Do I need to write a separate script for each of these 50 moves?
Writing a separate script for each folder would not only be time-consuming but would probably result in typos or other path errors that could cause a copy operation to fail or destroy some data. The RobocopyFromList.bat script that Listing 1 shows lets you use a comma-separated value (CSV) input file that contains the source and destination paths. Just copy or enter the source and destination locations into the file with one source and destination per line. Separate the source and destination with a comma, and put a comma after the destination. Figure 1 shows a sample input file.
Is there any way that Robocopy could destroy data?
Almost any tool that automates processes poses risks. Robocopy used with the /Purge option could delete data from the source location if you confused the source and destination locations in the command syntax. If you mistakenly named an empty or nearly empty folder as the source location and one of your large production file shares as the destination, Robocopy could delete your production file share by trying to make it match the empty folder. Fortunately, I've never had this happen, but I've exercised extreme caution. Always make a test run with the /L (list) switch to see whether the results match what you intend. An extra precautionary step would be to use a user account that has only Read permissions on the source location.
I ran two Robocopy operations to one top-level folder, but only the second one seemed to work. What happened?
I'm going to guess that you copied two folders to the same top-level folder with the /Purge switch on. For example, you copied the contents of E:\SalesData1 to R:\NewSales, then copied the contents of F:\SalesData2 to R:\NewSales. Actually, both of your Robocopy operations succeeded, but the /Purge switch on the F:\SalesData2 to R:\NewSales copy deleted all the files that you copied earlier from E:\SalesData1 to R:\NewSales. You need to either put two subfolders in the R:\NewSales folder or remove the /Purge switch from the second copy operation.
I have a Robocopy script on a server. While opening the script remotely to edit it, I accidentally launched it. How can I prevent this mistake in the future?
Because Robocopy can create a folder structure rather quickly, you want to ensure that it can't be accidentally launched on the wrong computer. RobocopyFromList.bat includes a line of code that checks for the computer name.
Another approach is to force the user of the Robocopy script to pass a parameter to the script to make it launch. Use an If statement that looks for a text string, such as
If Not "%1"=="YesIAmSure" EXIT
If the user doesn't run the script with the YesIAmSure argument, the script will exit.
Are there alternatives to Robocopy for large data migrations and server consolidations?
Secure Copy is a GUI tool that has a full command-line interface. As I mentioned earlier, if you use local groups to grant permissions on a server, copying to another server and getting the groups and their permissions to match can be difficult. Secure Copy can actually create matching local groups on the new server and streamline this procedure. Secure Copy can also copy simultaneously to multiple destinations. If you've become proficient with Robocopy and want to make the next logical jump to a tool with more functionality, Secure Copy is a good choice.
End of Article
Prev. page
1
2
3
[4]
next page -->