File Times and File Names

It is recommended that you make sure that both the source and destination directories reside on an NTFS partition, wherever possible. Copying to downlevel file systems (HPFS or FAT) will work, but you may lose long filenames, and file times may suffer from rounding errors on the destination. This is of course due to the superior capabilities of the NTFS file system.

For example, file time granularity is 100 nanoseconds on NTFS, but only 2 seconds on FAT, so copying a file from NTFS to FAT always causes file times to be rounded to a value that the FAT file system can handle. Accordingly, Robocopy considers file times to be identical if they are within two seconds of each other. Without this 2-second leeway, the program might erroneously classify many otherwise unmodified files as Older or Newer files, which would result in a great deal of unnecessary copying of these unchanged files.

Sometimes this handling of file times needs to be overridden. For example, assume an NTFS tree is copied temporarily to FAT, then later the FAT tree (and all its rounded FAT file times) is copied to a local NTFS drive. Later, there may be need to recreate the original tree exactly. Refreshing the whole tree would do the job, but it would inefficient for a large tree. In such a scenario you should use the /T switch to force the copying of just file times for Same files, rather than the whole file that would be copied if /IS was used.

When the destination is on a FAT or HPFS partition, you may also experience problems when copying files and directories with long names, or whose names included extended Unicode characters. To overcome these problems, use the /FAT switch. This tells Robocopy to create destination files using system-generated names in the standard 8.3 FAT file system format, rather than trying to create long or extended filenames on downlevel file systems.

Attribute Processing

By default, Robocopy ignores source file attributes when selecting files to copy - any file matching other specified conditions will be copied regardless of its attribute settings.

The /A and /M switches both modify this behaviour, and cause only those source files with the Archive attribute set to be selected for copying. After copying the Archive attribute of the source file is left unmodified (still set) if /A was used, or reset (turned off) if /M was used.

Furthermore, the /XA:[R][A][S][H] (eXclude Attributes) switch can be used to exclude files from being copied if one or more of the given attributes is set. For example, you could specify /XA:R to prevent Read-only files from being copied. Similarly, /XA:SH would prevent any files with either or both of the System or Hidden attributes set from being copied.

After a file is successfully copied to the destination, the destination file's attributes are set to match those of the source file, except for the Archive bit, which is always set (turned on). This is to identify newly copied files and make it easy to back them up.

To modify this default behaviour, /A+:[R][A][S][H] (Attribute add) and /A-:[R][A][S][H] (Attribute subtract) can be used. For example, /A-:A would cause the Archive attribute to be reset, and /A+:R would render all copied files Read-only in the destination.

The exact order of attribute operations on newly copied destination files is as follows :

1.Attributes are copied from the corresponding source file.

2.The Archive attribute is set (turned on).

3.Attributes specified by /A+:[R][A][S][H] are set (turned on).

4.Attributes specified by /A-:[R][A][S][H] are reset (turned off).