How to copy files

Updated: 12/31/2020 by Computer Hope
Copying two files on the Windows 10 desktop.

To copy computer documents, pictures, or other files from one place to another, follow these instructions.

Note

When copying files, you are going to get more than one copy of the file on your computer. If you want only one copy of the files, move them instead. For help with moving, see: How to move files and folders on the computer.

Note

A file name must be unique, if it's not, a number will be appended to the end of a file name. It may also have "- Copy" appended to the end of the file name, instead of a number. Appending a number to the end of the copied file's name assures the copied file is unique. For example, if the original file name is abc123.pdf and a copy is created in the same directory or folder, the copied file name could be abc123(1).pdf or abc123 - Copy.pdf.

Select your operating system to view the instructions that apply to you.

How to copy a file in Microsoft Windows

Copying files in Windows

Below are the steps on how to copy a file or multiple files in Microsoft Windows from one location to another.

  1. Go to the files or folders you want to copy. If you need help locating the files, use the Windows find feature.
  2. Highlight the file or files you want to copy by clicking them once with the mouse. If you need to highlight more than one file, you can hold down the Ctrl or Shift keys on your keyboard or drag a box around the files you want to copy.
  3. Once highlighted, right-click one of the highlighted files and select copy. Users may also press the Ctrl+C shortcut key, or in Windows Explorer, click Edit at the top of the window and choose Copy.
  4. Open the destination folder, right-click an empty space in the folder, and choose paste. Or, in the menu bar at the top, click File, choose Edit, then choose Paste.
Tip

If you want to copy only a certain type of file, you can click the Type column in Windows Explorer. This action sorts files by type, rather than by name. Once grouped by type, you can select only the files with the type you want to copy, and copy those files.

Tip

You can also use the Windows command line to copy files. In some situations, such as copying multiple files of a certain extension or with a certain name, it can be easier.

How to copy a file in MS-DOS and the Windows command line

copy command

Below are steps on how to copy a single file from one directory to another directory.

Copying a single file

  1. Using the cd command, move to the directory containing the file you want to copy.
  2. Type a command similar to the following command.
copy myfile.txt c:\my\location

In the example above, you would substitute "myfile.txt" with the name of the file you want to copy, and "c:\my\location" with the destination directory. To see files available in the current directory use the dir command.

Copying multiple files to another location

Below are the steps on how to copy multiple files from one directory to another directory.

  1. Using the cd command, move to the directory containing the files you want to copy.
  2. Once in the directory containing the files you want to copy, type a command similar to one of the following commands.
copy *.* c:\mydir

In the example above, the command would copy every file in the current directory to the "mydir" directory.

copy *.txt c:\mydir

In the example above, the command would copy every txt, or text file, in the current directory into the "mydir" directory.

Tip

For additional examples of wildcard characters, see our wildcard definition.

xcopy hope example /e

If you need to copy files, directories, and subdirectories, use the xcopy command. In the example above, this xcopy command copies all directories (even empty directories) and files from the hope directory into the example directory.

Copying long file name files or files with spaces

Many times, you can encounter a file with spaces in the file name. To copy these files, surround the full file name and file extension in quotes.

copy "computer hope.txt" "there is hope.txt"

In the example above, the "computer hope.txt" file is surrounded in quotes to let the command line know the complete file name, thus eliminating the spaces.

How to copy files to another drive

You can also copy files from the current location to any other drive. For example, if you have a USB flash drive that is drive letter F:, you can use the following command to copy all JPEG image files to the flash drive.

copy *.jpg f:

How to make a copy of a file into the same directory

copy example.txt backup.txt

In the example above, the file "example.txt" is copied into the same directory as "backup.txt," effectively making a backup copy of the file.

Related pages and help

Batch file

To perform any copy command in a batch file, include any of the above Windows command line copy commands in a batch file.

How to copy files in Linux and Unix

cp command

Below are steps on how to copy a single file from one directory to another directory.

Copying a single file from one location to another

  1. Using the cd command, move to the directory containing the file you want to copy.
  2. Type a command similar to the following command.
cp myfile.txt /usr/bin

In the example above, you would substitute "myfile.txt" with the name of the file you want to copy, and "/usr/bin" with the destination directory. To see files available in the current directory use the ls command.

Copying multiple files to another location

Below are the steps on how to copy multiple files from one directory to another directory.

  1. Using the cd command, move to the directory containing the files you want to copy.
  2. Once in the directory containing the files you want to copy, type a command similar to one of the following commands.
cp *.* /usr/bin

In the example above, the command would copy every file in the current directory to the "/usr/bin" directory.

cp *.txt /usr/bin

In the example above, the command would copy every txt, or text file, in the current directory into the "/usr/bin" directory.

For additional examples of wildcard characters, see our wildcard definition.

Copying files with spaces in the file names

Many times you can encounter a file with spaces in the file name. To copy these files, surround the full file name and file extension in quotes.

cp "computer hope.txt" "there is hope.txt"

In the example above, the "computer hope.txt" file is surrounded in quotes to let the command line know the complete file name. In our example, the destination file name contains whitespace (spaces), so the name is enclosed in quotes.

How to make a copy of a file into the same directory

cp example.txt backup.txt

In the example above, the file "example.txt" is copied into the same directory as "backup.txt," effectively making a backup copy of the file.

Related pages and help

How to copy files in Apple macOS

Drag-and-drop

Highlight the files you want to copy. Then, click with your left mouse button and, while continuing to hold down the mouse button, drag-and-drop the files to where you want them. When you release the mouse button, the files are copied.

Keyboard shortcut

You can also copy files using keyboard shortcuts by following these steps.

  1. Highlight the files you want to copy.
  2. Press the keyboard shortcut Command+C.
  3. Move to the location you want to move the files and press Command+V to copy the files.

Terminal

To copy files in a Terminal session, use the cp command.