How to copy a directory or folder
- Locate and highlight the folder you want to copy.
- Right-click the folder and click Copy or click Edit and then Copy.
- Move to the location you want to place the folder and all its contents and click Edit and then Paste or right-click and then click Paste.
Tip: You can also use the keyboard shortcuts to copy and paste files on the computer. For example, you could highlight any file and press Ctrl + C to copy the file. Once copied you can move to where you want to paste the file and then press Ctrl + V to paste the file.
MS-DOS and Windows command line
To copy a directory in MS-DOS use the MS-DOS xcopy command. Below is a basic example with each of the steps to do this in MS-DOS. If you need additional information about the xcopy command or additional examples see the above xcopy command page.
Copy a directory and contents
xcopy c:\example c:\example2
In the above example the directory "example" is copied into a new directory called "example2".
Copy the contents of directory into another directory
- Move to the directory of where you want to copy the directories and subdirectories. In the example below we will be moving to the temp2 directory using the cd command.
- Once in the directory use the xcopy command to copy another directories subdirectories and contents. In the example below we're copying the "temp3" contents into the "temp2" directory. Keep in mind that this will not copy the actual directory "temp2" just the files and directories in that directory.
xcopy c:\temp3 /e
Once the above steps have been completed everything should be copied into the temp2 folder.
Copy a directory with a space in the name
Tip: When dealing with a space in a file or directory you always surround it with quotes.
xcopy c:\test "c:\space test"
In the above example the directory "test" is copied into a new directory called "space test".
Linux and Unix
To copy a directory with all subdirectories and files use the Linux and Unix cp command. Below is an example command of how you would use the cp command to copy files. Additional information about this command and other examples can also be found in the above cp link.
cp -r /home/hope/files/* /home/hope/backup
In the above example the cp command would copy all files, directories, and subdirectories in the /home/hope/files directory to the /home/hope/backup directory.