Link to home
Start Free TrialLog in
Avatar of itgolfer
itgolfer

asked on

Robocopy Help

I'm trying to copy a lot of data from one of our servers to an external hard drive. I've used Robocopy in the past but I can't seem to get it to work for this. I started with the command below but when I run the batch file, it just sits there with the command prompt open. I thought maybe it was the log command at the end so I took that off but it still doesn't run correctly. I eventually took everything off after the destination and it still doesn't work. What am I missing?


robocopy "\\server\VOL1\Data\folder"  "E:\SourceData\Microsoft PDF Documents" *.* /MIR /COPYALL /R:1 /W:1 /MT:50 >> C:\RoboCopy\roboaccountingarchiveslog.txt
Avatar of Dariusz Tyka
Dariusz Tyka
Flag of Poland image

Try this command:
robocopy "\\server\VOL1\Data\folder" "E:\SourceData\Microsoft PDF Documents" /MIR /COPYALL /ZB /R:1 /W:1 /MT:50 >> C:\RoboCopy\roboaccountingarchiveslog.txt
Of course you would need permission to source & destination locations for successull operation.
I would use the following command:

robocopy "\\server\VOL1\Data\folder"  "E:\SourceData\Microsoft PDF Documents"  /MIR /COPYALL /R:1 /W:1 /MT:50  /LOG:C:\RoboCopy\roboaccountingarchiveslog.txt

you don't need the *.*, because it is a default configuration.  I added the /LOG: because the command has the function added, why redirect.  use /LOG+: if you want to append to your log file,  I also include /XO to exclude older files, and /NP for no progress, so my final command would be:

robocopy "\\server\VOL1\Data\folder"  "E:\SourceData\Microsoft PDF Documents"  /MIR /COPYALL /R:1 /W:1 /MT:50 /NP /XO /LOG:C:\RoboCopy\roboaccountingarchiveslog.txt

The only switch that could be giving you problems would be /COPYALL, it copies all the permissions and that could be causing an issue.  If you source and destination devices are not in the same domain, it could be the hicup.
Avatar of itgolfer
itgolfer

ASKER

I copied what you had and I get the same result. It opens the command prompt window and just sits there. It's probably been 15 minutes so am I not being patient enough? I just assumed it would start right away.

User generated image
Can you confirm the user that runs robocopy has correct permission on server? If not you may use 'run as' and open cmd with credentials that have admin  permission on the source server.
You should always open the command window first, then enter the robocopy line this way when robocopy errors out as it might be, you will be in a position to see the message/error.

I would advise against using /MiR option. Unless you understand the risk mainly deals with an erasure of a document on the server if not detected in time will be deleted from the external.

Your issue is that this system is acting as an intermediary retrieving data from the network share, and then copying it to E drive,
Any reason why the external drive is not directly plugged into the system from which the data copy should occur?

The first thing robocopy does is determine what the source data is, then it has to evaluate/compare what the destination has.
In a large data it could take hours to process such a copy on the first pass, on subsequent depending on the quantity of changes, it will get faster to complete.

Has though been given to using wbadmin to create backup files of the data?
Simplify the command pull out the /ZB and the /MT and the  /LOG make it work first then add on the bells and whistles:

robocopy "\\server\VOL1\Data\folder"  "E:\SourceData\Microsoft PDF Documents"   /R:1 /W:1 /XO

This command will copy from source to destination, with only moving on locked files after 1 retry and ignore any files that have been already copied.
Yes, I'm logged in as the domain admin and running the file as admin. That user does have the required permissions.

It thought it might take a while to begin as it is a large folder but while troubleshooting, I change the source to a folder on the local PC that has a text file in it and it still just sits there.

The server that the data resides on is offsite, which is why I can't plug the external drive directly into it.
You say offsite, how are you accessing the file.  Can you simply go to \\server\VOL1\Data\folder and copy 1 file from there to the E: drive using explorer?
What you may try is to map this path as a network drive (z: or any available letter) to your workstation and change the command to:
Robocopy z:  "E:\SourceData\Microsoft PDF Documents" with rest of the switches.
Yes, I can browse to \\server\VOL1\Data\folder and copy folders/files to the external HD.

I did make it a little farther by just typing the command into a command prompt instead of creating a batch file. However, I was trying it with just 1 folder in side of \\server\VOL1\Data\folder but it's showing that it skipped it. Inside of the A000001 folder is a number of other folders that contain PDFs.

User generated image
add the /E switch
You have to be patient then.
Try this, after you open the command window
Run dir \\server\VOL1\
Do you get data back?
Then repeat adding a folder at a time from your source reference
see whether the simple listing works...

/ZB is backup mode do not record the /XO

Try running with /L meaning it will display what it might have done.

Try fewer options. Nothing will be copied.
Robocopy \\server\VOL1\Data\folder "E:\SourceData\Microsoft PDF Documents" *.* /E /ZB /copyall /L

Wait as long as it takes
I created a mapped drive to the folder location and then changed the command to the one below and tried running it but it still doesn't copy and shows that the dirs was skipped.

robocopy "Z:" "E:\SourceData\Microsoft PDF Documents"
If I type dir \\server\vol1\ I do get a listing back.
I believe it was the /E switch that fixed it. It's now copying everything and since they were all in subfolders, I'm guessing it didn't know since it was missing the /E. It did copy everything and I double checked it but it still shows that it skipped 1directory. Is there a way to see which one it skipped as it looks like everything is there.
/E means process empty folders, recursively, the absence of /E and potentially /MIR might have thrown a wrench .... But I think it shoukd gave processed and finished .......


Which settings/options are you using?
I am using robocopy "Z:" "E:\SourceData\Microsoft PDF Documents" /R:1 /W:1 /E
ASKER CERTIFIED SOLUTION
Avatar of Shawn McCloskey
Shawn McCloskey
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks, I added that and it looks like it's just skipping the Z mapped drive.

One last question, hopefully. I'm hoping to run this for the next few nights to make sure I get everything. What do I need to add to it to only copy changes? New files, folders, etc.?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Perfect, thanks. There are no other commands or switches needed to only copy the changes?
The /XO Switch will exclude older files, so during checks if the file source is the same or older as the destination, then it will be ignored, thus only copying new and updated files.  if you are using the /LOG+ switch you will see this when going through the logs.
synctoy https://www.microsoft.com/en-us/download/details.aspx?id=15155 no you do not need a switch to only copy newer versions since the last copy it is automatic, though depending on what the data is like on the source, you might want to use /XD "Volume Shadow Copy" and other similar folders even through your /w:1 and /R:1 are set dealing with how many retries if the file is locked and how long to wait between attempts.

Have not used /XO though I think it needs a reference file on whose basis older is determined.