xcopy - copy files and folders _ windows cmd _ ss64
TRANSCRIPT
8/16/2019 Xcopy - Copy Files and Folders _ Windows CMD _ SS64
http://slidepdf.com/reader/full/xcopy-copy-files-and-folders-windows-cmd-ss64 1/3
8/16/2019 Xcopy - Copy Files and Folders _ Windows CMD _ SS64
http://slidepdf.com/reader/full/xcopy-copy-files-and-folders-windows-cmd-ss64 2/3
3/21/2016 Xcopy - Copy files and folders | Windows CMD | SS64.com
http://ss64.com/nt/xcopy.html 2/3
/J Copy using unbuffered I/O. Recommended for very large files.
/Q Do not display file names while copying.
/F Display full source and destination file names while copying.
/L List only - Display files that would be copied.
/Z Copy files in restartable mode. If the copy is interrupted part way through,
it will restart if possible. (use on slow networks)
Destination Options
/R Overwrite read-only files.
/T Create folder structure, but do not copy files.
Do not include empty folders or subfolders.
/T /E will include empty folders and subfolders.
/K Copy attributes. XCOPY will otherwise reset read-only attributes.
/N If at all possible, use only a short filename (8.3) when creating
a destination file. This can be necessary when copying between disks
that are formatted differently e.g NTFS and VFAT, or when archiving
data to an ISO9660 CDROM.
/O Copy file Ownership and ACL information.
/X Copy file audit settings (implies /O).
XCOPY will accept UNC pathnames.
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.1microsecond for an NTFS volume.
Copy a single file
In most cases copying a single file is best done with the COPY command. When copying a single file with XCOPY,there is no option to indicate if the destination is a filename or a directory (with the filename defaulting to that of the
source file).In such cases XCOPY will prompt with a (locale specific) message like:C:\> xcopy foo.txt bar.txt
Does foo.txt specify a file name
or directory name on the target
(F = file, D = directory)?
Adding a wildcard (*) to the end of the destination will suppress this prompt and default to copying as a file:C:\> xcopy foo.txt bar.txt*
C:foo.txt
1 File(s) copied
This requires the source and target file extensions to be the same length, typically 3 characters.
Insufficient Memory error
Attempting to XCOPY a source file that has a pathname longer than the Windows maximum path length (254characters) will result in a rather unhelpful 'Insufficient Memory' error, the operation will then halt. This bug which hasbeen around for over 10 years makes XCOPY a poor choice for any kind of backup script, use ROBOCOPY instead.
Examples:
Copy a file:
echo F| XCOPY C:\utils\MyFile.txt D:\Backup\CopyFile.txt
Copy a folder:
XCOPY C:\utils D:\Backup\utils /i
Copy a folder including all subfolders.
XCOPY C:\utils\* D:\Backup\utils /s /i
“It is easier to copy than to think, hence fashion” ~ Wallace Stevens
8/16/2019 Xcopy - Copy Files and Folders _ Windows CMD _ SS64
http://slidepdf.com/reader/full/xcopy-copy-files-and-folders-windows-cmd-ss64 3/3
3/21/2016 Xcopy - Copy files and folders | Windows CMD | SS64.com
http://ss64.com/nt/xcopy.html 3/3
© Copyright SS64.com 1999-2016
Some rights reserved
Related:
COPY - Copy one or more files to another locationDEL - Delete filesMOVE - Move a file from one folder to anotherROBOCOPY - Robust File and Folder CopyPowerShell: Copy-Item - Copy an item from one location to anotherEquivalent bash command (Linux): cp - Copy one or more files to another location