IT tutorials
 
Windows
 

Windows Server 2008 Server Core : Working with Data - Performing Robust File Transfers with the RoboCopy Command

- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019
12/10/2012 11:05:21 AM
RoboCopy is a sort of super XCopy utility, in that you can copy a large number of files from one location to another. However, RoboCopy also provides a considerable number of file selection options and even job options, so that you can submit a copy requirement as a job. The source and destination can include Universal Naming Convention (UNC) paths, in addition to the standard paths. Unlike XCopy, you don't have to resort to odd logging methods because RoboCopy has them built in so you can see precisely what happened during the copying process. In addition, RoboCopy is forgiving in that it provides retry options to ensure a copy process has the best possible chance to succeed. This command uses the following command line syntax:
ROBOCOPY Source Destination [File [File]...] [Copy Options] [File Selection
Options] [Logging Options] [Retry Options] [Job Options]

The command line switches for RoboCopy aren't the same as the command line switches for XCopy. Consequently, you can't perform a simple search and replace in your batch or script files to use RoboCopy; you must completely rewrite the command.


The copying options define how RoboCopy performs copying tasks. For example, you might want to include all of the folders in the copied location, even those that are empty, so you'd use the /E command line switch. The following list describes each of the copy command line arguments.


/S

Copies all files in the current directory, plus all subdirectories and their files except empty subdirectories. You can't use this command line switch to create an empty directory structure for a user or application; use the /E command line switch instead.


/E

Copies all files in the current directory, plus all subdirectories and their files including empty subdirectories.


/LEV:
n

Copies only the top-level subdirectories specified by n. For example, if n is 3, then RoboCopy only copies three subdirectories down. If there's a fourth-level subdirectory, it won't appear in the copy.


/Z

Copies the files using restartable mode. Using restartable mode means that you can restart the operation should an external force interrupt it. Normally, RoboCopy restarts an operation from the beginning with the retry options, but this command line switch restarts the copy with the failed file.


/B

Copies files using backup semantics. When using this mode, you must have the backup right. Using backup semantics helps you overcome some obstacles where you might ordinarily receive an access denied error, such as copying a file for which you have only the write privilege. The resulting copy has all of the same Access Control List (ACL) entries as the original, so this feature doesn't cause a breach in security.


/ZB

Attempts to perform the copy using restartable mode first (see the /Z command line switch) and then uses backup mode if restartable mode fails.

NOTE

Using the /Z, /B, or /ZB command line switches can slow RoboCopy performance because the utility must perform additional file tracking as it makes a copy. However, the performance loss is more than overcome when working with unreliable network connections because you gain additional flexibility in handling troublesome files.


/EFSRAW

Copies all of the encrypted files in the Encrypting File System (EFS) Read-After-Write (RAW) mode.


/COPY:
Copy_Flags

Defines which elements to copy from the source files to the destination files. For example, you might want to copy all of the owner information, but don't really care about the auditing information. The following list defines the copy flags.

D Data
A Attributes
T Time stamps
S Security (NTFS) ACLs
O Owner info
U Auditing info

/DCOPY:T

Copies the directory time stamps. RoboCopy normally uses the current time for the time stamps.


/SEC

Copies the files with all of the security information intact. This command line switch has the same effect as the /COPY:DATS command line switch.


/COPYALL

Copies all of the file information with the files. This option makes a nearly mirror copy of the data from the source to the destination. Using this option is equivalent to using the /COPY:DATSOU command line switch.


/NOCOPY

Performs a copy without copying any of the file data. This feature is useful with the /PURGE command line switch. You can also use it when checking for potential copy errors since the process is extremely fast when you don't copy the file data.


/SECFIX

Repairs the security information for a set of destination files. This option lets you update the security information without copying the file data, making the repair very fast. You can learn more about this feature in the Knowledge Base article at http://support.microsoft.com/kb/323275.


/TIMFIX

Repairs the time stamps for a set of destination files. This option lets you update the time stamps without copying the file data, making the change quite fast. This feature works very much like the /SECFIX command line switch, except it affects the time stamps, rather than security.


/PURGE

Deletes the files in the destination directory that no longer exist in the source folder. Consequently, the files in the destination directory match the files in the source directory after you use this command line switch.

Use the /PURGE command line switch with extreme care. Even a small error in the command line arguments can delete a significant number of destination data. Whenever you use the /PURGE command line switch, the RoboCopy command removes any files that exist as part of the Extra file class. See the sidebar entitled, "An Overview of RoboCopy File Classes" for additional details.



/MIR

Creates a mirror image of the source directory in the destination directory. Using this command line switch is equivalent to combining the /E and /PURGE command line switches.


/MOV

Moves only the files in the source directory to the destination directory. RoboCopy deletes the files in the source directory after copying them to the destination directory.


/MOVE

Moves both files and subdirectories from the source directory to the destination directory. RoboCopy deletes the files and subdirectories in the source directory after copying them to the destination directory.


/A+:[RASHCNET]

Adds the requested attributes to the copied files. RoboCopy actually provides access to more attributes than the Attrib utility. The following list describes each of the attributes.

  • R: Read-only

  • A: Archive

  • S: System

  • H: Hidden

  • C: Compress

  • N: Nonindexed

  • E: Encrypted

  • T: Temporary

  • O: Offline (/XA and /IA command line switches only)

NTFS actually supports a number of attributes that you can't readily access. You can find them discussed at http://www.febooti.com/products/filetweak/online-help/.



/A-:[RASHCNET]

Removes the requested attributes from the copied files. The meanings of the attributes are the same as the /A+ command line switch.


/CREATE

Creates a directory tree and zero-length files. You can use this feature when you need to copy the infrastructure from one location to another without copying the data.


/FAT

Removes the long filenames from the destination files. All the files appear using the 8.3 File Allocation Table (FAT) file system format.


/256

Turns off the long path support that RoboCopy provides. If RoboCopy detects a long path, it raises an error. The only time you'd need to use this feature is if the destination doesn't support long paths. For example, if you wanted to copy to an older system with DOS (or even some camera or flash drives), you would probably want to use this command line switch.


/MON:
n

Monitors the source directory and performs a copy when more than n changes occur. Unlike XCopy, you can use RoboCopy to keep source and destination files synchronized automatically.


/MOT:
m

Monitors the source directory and performs a copy after m minutes if RoboCopy detects a change. You can use this option to keep the number of copies under control for a high activity directory. RoboCopy uses a set amount of system resources, rather than using resources based on activity as the /MON:n command line switch does.


/RH:
hhmm-hhmm

Defines the hours when RoboCopy can run. You can use this feature to ensure that copies only occur during nonpeak hours or after work. Use a 24-hour clock when defining the time range. For example, 1 p.m. is actually 1300.


/PF

Determines the RoboCopy run hours on a per file basis instead of checking at the beginning of each pass. This option does incur a performance penalty because RoboCopy must check to determine whether a copy is allowed for each file, but it does mean that the copying process will conform better to the hours set by the /RH command line switch.


/IPG:
n

Determines the Inter-Package Gap (IPG) value in milliseconds (ms). A higher IPG frees bandwidth for other uses on slower network paths. A lower IPG helps RoboCopy perform better and accomplish tasks faster.

RoboCopy also provides a complex set of file selection options. These options determine which files actually appear in the destination directory. RoboCopy supports the following file selection option.


/A

Includes files with the archive attribute set. The operating system sets the archive attribute whenever anything changes a file. This option doesn't reset the archive attribute, which makes it useful when you want to create a backup of archived files later.


/M

Includes files with the archive attribute set. This option resets the archive attribute, so this is the command line switch to use when you use RoboCopy for backup purposes.


/IA:[RASHCNETO]

Includes only the files that have the requested attributes set. See the /A+ command line switch for details.


/XA:[RASHCNETO]

Excludes all of the files that have the requested attributes set. See the /A+ command line switch for details.


/XF
File [File
]...

Excludes any files that match the specified names or paths. The specifications can include wildcard characters.


/XD
Directory [Directory
]...

Excludes any directories that match the specified names or paths. The specifications can include wildcard characters.


/XC

Excludes Changed files. See the "An Overview of RoboCopy File Classes" sidebar for details on this file class.


/XN

Excludes Newer files. See the "An Overview of RoboCopy File Classes" sidebar for details on this file class.


/XO

Excludes Older files. See the "An Overview of RoboCopy File Classes" sidebar for details on this file class.


/XX

Excludes eXtra files and directories. See the "An Overview of RoboCopy File Classes" sidebar for details on this file class.


/XL

Excludes Lonely files and directories. See the "An Overview of RoboCopy File Classes" sidebar for details on this file class.


/IS

Includes Same files. See the "An Overview of RoboCopy File Classes" sidebar for details on this file class.


/IT

Includes Tweaked files. See the "An Overview of RoboCopy File Classes" sidebar for details on this file class.


/MAX:
n

Defines the maximum file size to include in bytes. Excludes any file larger than n bytes.


/MIN:
n

Defines the minimum file size to include in bytes. Excludes any file smaller than n bytes.


/MAXAGE:
n

Defines the maximum file age to include. Excludes any file older than n days old. You can also specify a date.


/MINAGE:
n

Defines the minimum file age to include. Excludes any file newer than n days old. You can also specify a date.


/MAXLAD:
n

Defines the maximum last access date to include. Excludes any file unused in n days. You can also specify a date.


/MINLAD:
n

Defines the minimum last access date to include. Excludes any file used in n days. You can also specify a date.


/XJ

Excludes junction points for both directories and files (normally included with the results).


/FFT

Assumes FAT File Times (FFT), which have a 2-second granularity.


/DST

Compensates for one-hour daylight standard time (DST) time differences.


/XJD

Excludes junction points for directories.


/XJF

Excludes junction points for files.

Many command line utilities try an operation once and then fail if it doesn't succeed. RoboCopy continues to retry the task until you press Ctrl+C, in most cases, to stop the process manually (even RoboCopy gives up after 1 million retries). You can also tell RoboCopy how to react to failure conditions. The following list describes the retry options.


/R:
n

Modifies the number of retries on failed copies to n. The default setting is 1 million retries.


/W:
n

Defines the wait time between retries. The default setting is 30 seconds.


/REG

Saves the /R:n and /W:n command line switches in the registry as default settings.


/TBD

Tells RoboCopy to wait for sharenames To Be Defined (TBD). This command line switch addresses retry error 67.

Given everything that RoboCopy can do, you might not want to wait for it to accomplish a task. Consequently, RoboCopy provides logging options that you can use to output data to a permanent location. The following list describes the logging options.


/L

Provides a list of files only. RoboCopy doesn't copy, time stamp, or delete any files.


/X

Produces a report of all eXtra files, not just those selected.


/V

Produces verbose output, which includes skipped files.


/TS

Includes source file time stamps in the output.


/FP

Includes the full pathname of files in the output.


/BYTES

Prints the sizes of files in bytes.


/NS

Doesn't log file sizes.


/NC

Doesn't log file classes.


/NFL

Doesn't log filenames.


/NDL

Doesn't log directory names.


/NP

Doesn't display a progress indicator showing the percent copied.


/ETA

Shows the estimated time of arrival of copied files. This option is helpful when copying large files over slow networks.


/LOG:
file

Outputs status to the log file and overwrites any existing log.


/LOG+:
file

Outputs status to the log file and appends the information to any existing log.


/UNILOG:
file

Outputs status to the Unicode log file and overwrites any existing log.


/UNILOG+:
file

Outputs status to the Unicode log file and appends the information to any existing log.


/TEE

Outputs status to the console window, as well as the log file.


/NJH

Doesn't include a job header with the output.


/NJS

Doesn't include a job summary with the output.


/UNICODE

Outputs status using Unicode rather than ASCII characters.

You may want to use RoboCopy to perform complex tasks over the weekend or during a down-time. If you're using RoboCopy as one means of backup for your system, you might want to perform the task at night. In all of these situations, you'll want to create a RoboCopy job to perform the task. The following list describes the job options.


/JOB:
jobname

Uses parameters from the named job file to perform a task. A job file is simply a list of RoboCopy and other commands that define what you want RoboCopy to do—a kind of script. The text file can contain any number of RoboCopy commands. You can also use the Set command to create local variables to hold values that you want RoboCopy to use .


/SAVE:
jobname

Saves the current command line arguments to the named job file. This is one of the easiest ways to create a job file for use with the /JOB command line switch.


/QUIT

Quits after processing command line so that you can view any arguments. This is a way to test jobs without actually performing the tasks that the jobs request.


/NOSD

Specifies that you haven't defined a source directory in the job file. RoboCopy uses the current directory.


/NODD

Specifies that you haven't defined a destination directory in the job file. RoboCopy uses the current directory.


/IF

Includes external files as part of the current job. This feature lets you concatenate multiple jobs together and perform them as a unit.

An Overview of RoboCopy File Classes

RoboCopy classifies files in several ways to make handling specific file conditions easier. The following list provides an overview of the RoboCopy file classes:


Lonely

A lonely file exists in the source directory, but not in the destination directory. If you perform an update copy using RoboCopy, the utility copies the file to the destination.


Tweaked

Tweaked files exist in both the source and destination directories. The file size and time stamp are the same. However, the attributes (those set with the Attrib utility) differ. You can fix this problem by specifically copying the attributes from the source to the destination. A standard copy won't affect the attributes when the file falls into this class.


Same

The source and destination files are the same in all respects.


Changed

The file exists in both the source and destination directories. The time stamp for both files is also the same. However, the file size differs. RoboCopy doesn't consider the status of the attributes when placing a file into this class.


Newer

The file exists in both the source and destination directories. The time stamp of the file in the destination directory is newer than the one in the source directory. RoboCopy doesn't consider the status of the file size or attributes when placing a file into this class.


Older

The file exists in both the source and destination directories. The time stamp of the file in the source directory is newer than the one in the destination directory. RoboCopy doesn't consider the status of the file size or attributes when placing a file into this class.


eXtra

An extra file exists in the destination directory, but not in the source directory. You can use the /PURGE command line switch to remove extra files. However, use the /PURGE command line switch with extreme care because a typo can cause RoboCopy to delete the entire destination directory.


Mismatched

The entry exists as a file in the source directory and as a folder in the destination directory. RoboCopy reports this problem in the output log, but doesn't attempt to fix it.

 
Others
 
- Windows Server 2008 Server Core : Understanding JavaScript and VBScript Compilers, Editing Script Files with Script Editor 2.1
- Xbox Live Games in Windows 8 : Customizing Your Avatar, Finding and Playing Your Favorite Games
- Watching and Sharing Video in Windows 8 : Exploring Video, Using the Movies Marketplace
- Windows 7 : Running Programs and Gadgets - Making Specialized Calculations, Writing Equations and Formulas
- Windows 7 : Running Programs and Gadgets - Inserting Special Characters, Crunching Numbers
- Windows 8 : Grooving to Your Tunes (part 2) - Adding Music to Your Collection. Purchasing Tunes
- Windows 8 : Grooving to Your Tunes (part 1) - Getting Started with the Music App, Listening to Music Previews
- Configuring Windows Home Server 2011 : Configuring the Windows Home Server Startup
- Configuring Windows Home Server 2011 : Changing the Windows Home Server Password, Restarting or Shutting Down Windows Home Server
- Configuring Windows Home Server 2011 : Selecting the Windows Home Server Region, Configuring Windows Update
 
 
Top 10
 
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
Technology FAQ
- Is possible to just to use a wireless router to extend wireless access to wireless access points?
- Ruby - Insert Struct to MySql
- how to find my Symantec pcAnywhere serial number
- About direct X / Open GL issue
- How to determine eclipse version?
- What SAN cert Exchange 2010 for UM, OA?
- How do I populate a SQL Express table from Excel file?
- code for express check out with Paypal.
- Problem with Templated User Control
- ShellExecute SW_HIDE
programming4us programming4us