Copies files and directories, including subdirectories.
![]() -->
In the windows world I would use xcopy. Specifically, I'm copying 300gb of home directories as a backup before I do an update on the OS. I won't have time.
For examples of how to use this command, see Examples.
SyntaxParameters
Remarks![]()
Press F if you want the file or files to be copied to a file. Press D if you want the file or files to be copied to a directory.
You can suppress this message by using the /i command-line option, which causes xcopy to assume that the destination is a directory if the source is more than one file or a directory.
![]()
Examples
1. To copy all the files and subdirectories (including any empty subdirectories) from drive A to drive B, type:
2. To include any system or hidden files in the previous example, add the/h command-line option as follows:
3. To update files in the Reports directory with the files in the Rawdata directory that have changed since December 29, 1993, type:
4. To update all the files that exist in Reports in the previous example, regardless of date, type:
5. To obtain a list of the files to be copied by the previous command (that is, without actually copying the files), type:
The file xcopy.out lists every file that is to be copied.
6. To copy the Customer directory and all subdirectories to the directory PublicAddress on network drive H:, retain the read-only attribute, and be prompted when a new file is created on H:, type:
7. To issue the previous command, ensure that xcopy creates the Address directory if it does not exist, and suppress the message that appears when you create a new directory, add the /i command-line option as follows:
8. You can create a batch program to perform xcopy operations and use the batch if command to process the exit code if an error occurs. For example, the following batch program uses replaceable parameters for the xcopy source and destination parameters:
To use the preceding batch program to copy all files in the C:Prgmcode directory and its subdirectories to drive B, type:
The command interpreter substitutes C:Prgmcode for %1 and B: for %2, then uses xcopy with the /e and /s command-line options. If xcopy encounters an error, the batch program reads the exit code and goes to the label indicated in the appropriate IF ERRORLEVEL statement, then displays the appropriate message and exits from the batch program.
9. This example all the non-empty directories, plus files whose name match the pattern given with the asterisk symbol.
In the preceding example, this particular source parameter value .toc*.yml copy the same 3 files even if its two path characters . were removed. However, no files would be copied if the asterisk wildcard was removed from the source parameter, making it just .toc.yml.
Additional references![]() Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
January 2023
Categories |