Saturday, November 8, 2014

Transfer Entire Drives, Directories, Large Files etc. with Xcopy

Transfer Entire Drives, Directories, Large Files etc. with Xcopy

If you are looking to transfer lots of files, large files, a large amount of data, or a combination of the above, you should consider using Xcopy—a command line tool used to copy data.

The Basic Syntax of Xcopy
To run Xcopy, open a command prompt:

Type xcopy followed by the source location (red) and the destination location (orange)

i.e. xcopy g:\ u:\ will copy everything from the G drive to the U drive.


How to Use Parameters to Refine Xcopy Behavior


Parameters can be used to refine the copying process. These parameters (blue) are added after the source and destination folders to apply certain rules; below is an explanation:

* /c : Ignores errors.
* /h : Copies files with hidden and system file attributes. By default, xcopy does not copy hidden or system files.
* /e : Copies all subdirectories, even if they are empty. Use /e with the /s and /t command-line options.
* /r : Copies read-only files.
* /k : Copies files and retains the read-only attribute on destination files if present on the source files. By default, xcopy removes the read-only attribute.
* /y : Suppresses prompting to confirm that you want to overwrite an existing destination file.
* /s : Copies directories and subdirectories, unless they are empty. If you omit /s, xcopy works within a single directory.


How to Output Xcopy Results to a Text File
If you want to create a text file with the results of the xcopy process (to check for any errors), you can add a parameter to create the text file (just like most commands.) Simply add >>out.txt (green) to the command (which will save the text file to the currently selected directory—in this case it’s C:\Users\)

No comments:

Post a Comment