XCOPY C:\utils\MyFile D:\Backup\CopyFile
To copy a folder:
XCOPY C:\utils D:\Backup\utils /i
To copy a folder including all subfolders.
XCOPY C:\utils\* D:\Backup\utils /s /i
The /i defines the destination as a folder.
Notes
In many cases the functionality of XCOPY is superseded by
ROBOCOPY
.
To always overwrite destination files use the COPYCMD environment variable:
SET
COPYCMD=/Y
When comparing Dates/Times the granularity (the finest increment of the timestamp) is 2
seconds for a FAT volume and 0.1 microsecond for an NTFS volume.
The WinXP version of XCOPY will accept wildcards for the source e.g.
*.txt
It is also more forgiving with trailing backslashes.
“It is easier to copy than to think, hence fashion” ~ Wallace Stevens