• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1151
  • Last Modified:

Robocopy Parameters

I am trying to copy a very large directory structure (400GB) including sub-directories from one location to another location using Robocopy.

However the copy process fails on a few files which means the whole copy operation fails.

Can anyone suggest the exact syntax/parameters which will allow the copy process to continue if particular files fail but where the names of the failing files will be logged to a text file which can be reviewed at a later date.
0
Chrissycan
Asked:
Chrissycan
3 Solutions
 
Miguel Angel Perez MuñozCommented:
This works for me:

c:\robocopy\robocopy.exe "Origin" "Destination" /E /COPYALL /XO /LOG:logfile.txt

Copy all, if a error found don´t stop copy and all process is recorded on a logfile.
0
 
oBdACommented:
robocopy's behavior on failing files is governed by the /r (retry, default 1 million) and /w (wait, default 30 seconds) parameters; they tell robocopy how often to retry a copy operation, and how long to wait (in seconds) between retry attempts. The default values will make robocopy wait for a really long time in cas eof an error, so these need to be reduced. If it's a stable LAN connection, set both to 0.
As far as logging is concerned, you can usually safely use /nfl (no file logging) and /ndl (no directory logging); this will only disable logging of successfully copied files, errors will always be logged. And if you're writing to a log file, use /np (no progress indicator), as this will clutter up the log file with control characters. Use /tee to have console output as well as logfile output.
It's no problem to start robocopy several times; it will by default only copy files that aren't in the target already. If you want to delete files in the target that don't exist in the source anymore (to have identical folder trees), use /mir (includes /e).
robocopy will by default only copy the file data, attributes, and time stamp. (/copy:DAT). For NTFS permissions, add a "S", for Owner an "O", for aUdit an U (shortcut to copy everything is /copyall).
So I'm usually using something like this:
robocopy "S:\ource\Folder" "T:\arget\Folder" *.* /copy:DATSOU /r:0 /w:0 /np /mir /nfl /tee /log:"robocopy-20110425-0325.log"

Open in new window


If you've installed the W2k3 Resource Kit to work with robocopy, check out robocopy.doc in the installation folder, it's a very useful documentation (which was dropped for whatever reason in Vista or later where robocopy is preinstalled).
0
 
Tony GiangrecoCommented:
It sounds like you are trying to copy files that are in use. You might want to add a few commands to stop the services for that app first then restart the services when the robocopy process completes. Put your actual services and robocopy command in a .cmd file and run it.

Something like this:

net stop "automatic updates"
net stop ....
robocopy.......
net start "automatic updates:
net start .....
0
Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

 
ChrissycanAuthor Commented:
Thanks all for your comments. I'm going to try these and will post back. It will be a while because there are a very large number of files to copy. They are being copied to a NAS Unit.
0
 
ChrissycanAuthor Commented:
oBdA

I read your comment and that was indeed the problem I had when I first used Robocopy i.e. it kept displaying waiting 30 seconds when it encountered a problem and never seemed to go beyond that.

I tried your command but it kept giving Access Denied 0X00000005 errors. I googled it and some suggested using copy:DT rather than Copy:DATSOU. This I have found allows the copy process to run.  

I would prefer to stick to your original syntax as much as possible as you obviously know what you are talking about. However I am concerned whether the destination structure will then be exactly the same as the source should a user start to access it.

Chris

.

 The rest of the commend looks perfect if I could get past the "Acess Denied" problem
0
 
oBdACommented:
If /copy:DT works, then so should /copy:DAT; but any of the /copy:SOU options require that you have Full access on all source files and folders.
It depends on the file structure whether you need to copy NTFS permissions, or if the file data is enough; do you actually need the permissions? In general, the local(!) administrators group on the file server and System should have Full access on all folders.
Oh, and if you're running this on Vista or later, make sure you're running robocopy from an elevated prompt.
0
 
ChrissycanAuthor Commented:
oBdA

Thanks again. I'll try that...This one's still on XP.
0
 
ChrissycanAuthor Commented:
oBdA

It worked very well. Will get the operator to test all files/permissions.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now