This article explains how to copy files with command line interface. You can use the “Copy” and “Xcopy” commands to copy files on your computer competently.
Let us follow the steps:
- Using “Copy” command- To transfer particular files.
- Open CMD (admin) using the start button.
- Execute the following command to copy “myfile.txt” from the C: drive to the E: drive.
copy c:\myfile.txt e:
- To copy all the text files in the present directory to the E: drive with a wildcard, run the below command-
copy *.txt e:
- The provided command copies the “example.xls” file from the D: drive to the current directory. If no destination is specified, the command utilises the current directory by default.
copy d:\example.xls
- Using the “Xcopy” Command- To copy all files.
- Xcopy is a utility that facilitates the copying of individual files or groups of files between directories, offering a convenient way to duplicate data to and from a fixed drive.
- Open CMD (admin) using the start button.
- Enter the Xcopy command to copy folders and subfolders, with their contents, as presented below.
- If you wish to copy the “example” folder and its subfolders from the C drive to the D drive, execute the command given below-
Xcopy C:\example D:\example /E /H /C /I
- Let us understand in detail-
- /E- Duplicates all subdirectories, containing any that are empty.
- /H- Duplicates files that are hidden or have system file attributes.
- /C- Regardless of encountering an error, continue the copying process.
- /I- Assume the destination is a directory if uncertain.
In such a manner, you can copy files using “Copy” and “Xcopy” commands in command prompt. For extra assistance, get help from our support specialists.
Interested in managing MySQL databases? Explore our guide on How to Copy a MySQL Table with phpMyAdmin.