XCOPY:

Windows NT 4 Syntax

Copies files and directory trees.

XCOPY source [destination] [/A | /M] [/C] [/D[:date]] [/F] [/H] [/I] [/K] [/L] [/N] [/P] [/Q] [/R] [/S [/E]] [/T] [/U] [/V] [/W] [/Z] [/EXCLUDE:filename]
source
Specifies the file(s) to copy.
destination
Specifies the location and/or name of new files.
/A
Copies files with the archive attribute set, doesn't change the attribute.
/C
Continues copying even if errors occur.
/D[:m-d-y]
Copies files changed on or after the specified date.
If no date is given, copies only those files whose source time is newer than the destination time.
/E
Copies directories and subdirectories, including empty ones.
Same as /S /E. May be used to modify /T.
/F
Displays full source and destination file names while copying.
/H
Copies hidden and system files also.
/I
If destination does not exist and copying more than one file, assumes that destination must be a directory.
/K
Copies attributes. Normal Xcopy will reset read-only attributes.
/L
Displays files that would be copied (list only).
/M
Copies files with the archive attribute set, turns off the archive attribute.
/N
Copies using the generated short names.
/P
Prompts you before creating each destination file.
/Q
Does not display file names while copying.
/R
Overwrites read-only files.
/S
Copies directories and subdirectories except empty ones.
/T
Creates directory structure, but does not copy files.
Does not include empty directories or subdirectories.
/T /E includes empty directories and subdirectories.
/U
Copies only files that already exist in destination.
/V
Verifies each new file.
/W
Prompts you to press a key before copying.
/Z
Copies networked files in restartable mode.
/EXCLUDE:filename
Excludes the files listed in the specified file from the copy operation. The exclusion file can have a list of exclusion patterns (one per line, no wild card characters are supported). If any exclusion pattern in the file matches any part of the path of a subject file, that file is not copied.

 

Examples

Copy only files older than Christmas day 2000:

FOR /F "tokens=1* delims=:" %%A IN ('XCOPY *.* D:\Mydir /D:12-25-2000 /H /I /L /R ˆ| FIND ":"') DO (>>%TEMP%.\exclude.lst ECHO.%%B)
XCOPY *.* D:\Mydir /EXCLUDE:%TEMP%.\exclude.lst /H /I /R

Delete files created or modified after Christmas 2000:

FOR /F "tokens=1* delims=:" %%A IN ('XCOPY *.* D:\Emptydir /D:12-26-2000 /H /I /L /R ˆ| FIND ":"') DO DEL /F %%B