Author Topic: Get to Know Robocopy for More Powerful File Management  (Read 3535 times)

0 Members and 1 Guest are viewing this topic.

Get to Know Robocopy for More Powerful File Management
« on: June 11, 2010, 05:56:08 PM »

Offline Nick

  • Administrator
  • Platinum Member
  • *
  • Posts: 46028
  • Karma: +1000/-0
  • Gender: Male
  • NickCS
    • http://www.facebook.com/nickcomputerservices
    • http://www.twitter.com/nickcomputer
    • Computer Chiangmai

Get to Know Robocopy for More Powerful File Management

Dragging files between folders is fine, but when it comes to heavy-duty file management you need a better tool. If you need more power and flexibility, it's time you get to know Robocopy.

Dragging files between folders with Windows Explorer is fine for some tasks, but when it comes to heavy-duty file management you need a better tool. If you’re willing to do a little typing in exchange for power and flexibility you can’t get with Windows Explorer, get to know Robocopy.


Robocopy (the name is short for Robust File Copy) was introduced with the Windows Server 2003 Resource Kit and is included in all editions of Windows 7. Its many strengths include the ability to copy all NTFS file attributes and to mirror the contents of an entire folder hierarchy across local volumes or over a network. If you use the right combination of options, you can recover from interruptions such as network outages by resuming a copy operation from the point of failure after the connection is restored.

The Robocopy syntax takes some getting used to. If you’re familiar with the standard Copy and Xcopy commands, you’ll have to unlearn their syntax and get used to Robocopy’s unconventional ways. The key difference is that Robocopy is designed to work with two directories (folders) at a time, and the file specification is a secondary parameter. In addition, there are dozens of options that can be specified as command-line switches. The basic syntax is as follows:

robocopy source destination [file [file]...] [options]

The source and destination parameters are specified as drive:\path or \\server\share\path. The file parameter can contain one or more literal file names, or it can use the familiar ? and * wildcards. Available options include dozens of switches that control copying, file selection, retry options, and the ability to create log files. For instance, this command copies the contents of one folder and all its subfolders from a local drive E to a shared folder on a Windows Home Server:

robocopy "E:\test" \\server\public\test\ /MIR /W:20 /R:15 /LOG: \\server\public\logs

The /MIR switch tells Robocopy you want to mirror the two folders, copying all folders (even empty ones) from the source directory and purging folders from the destination if they no longer exist on the source. The /W and /R switches set the wait and retry options; in this case, Robocopy will retry each copy up to 15 times, waiting 20 seconds between attempts. (The defaults allow 1 million retries, at 30-second intervals, allowing copy operations to complete when an open file is closed, even if hours or days have passed since the command was first launched.)

To see the full syntax, type robocopy /? at a command prompt.

Robocopy is a powerful tool, capable of moving, copying, and deleting files and folders faster than you can say “Whoops.” We recommend experimenting with commands using nonessential files and folders first; when you’re comfortable that you understand the effects of the syntax you’re using, you can run the command against real data files.

And if you aren’t keen on the idea of using a command-line tool, take heart. Microsoft engineer Derk Benisch has written a graphical front end that allows you to build a command by selecting check boxes instead of entering switches.

Robocopy GUI adds more than usability to Robocopy; it also lets you create a library of commonly used copy scripts. Check out this TechNet Magazine article about Robocopy GUI and download the app for your system.


From the Microsoft Press book Windows 7 Inside Out by Ed Bott, Carl Siechert, and Craig Stinson.

credit: technet.microsoft.com


 
Share this topic...
In a forum
(BBCode)
In a site/blog
(HTML)


Related Topics

  Subject / Started by Replies Last post
0 Replies
3143 Views
Last post June 16, 2010, 06:22:28 PM
by Nick
0 Replies
2857 Views
Last post March 17, 2011, 11:20:22 PM
by Nick
0 Replies
1800 Views
Last post May 20, 2012, 02:39:54 PM
by Nick
0 Replies
1505 Views
Last post July 03, 2012, 10:30:00 AM
by Nick
0 Replies
1457 Views
Last post November 09, 2012, 04:10:37 PM
by Nick
0 Replies
1833 Views
Last post December 25, 2012, 06:24:59 PM
by Nick
0 Replies
1441 Views
Last post February 18, 2013, 12:45:02 AM
by Nick
0 Replies
2603 Views
Last post March 07, 2013, 05:31:12 PM
by Nick
0 Replies
1452 Views
Last post March 24, 2013, 10:45:36 AM
by Nick
0 Replies
2486 Views
Last post July 02, 2013, 05:38:32 PM
by Nick