Copy dir
Copy dir
How to copy a directory or folder Depending on your computer operating system, and where you want to execute the copy, there are several ways to copy a directory or folder. Select a link below for your operating system or where you want to perform the copy.
Microsoft Windows
To copy a folder in Microsoft Windows, follow the steps below. When copying a folder in Windows, everything in the folder, including all files and subdirectories are copied.
Locate and highlight the folder you want to copy.
Right-click the folder and select Copy, or click Edit and then Copy.
Move to the location you want to place the folder and all its contents, and right-click and select Paste, or click Edit and then Paste.
Tip
Once a file is copied, it can be pasted anywhere on the computer, including the desktop, another folder, or a drive.
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 xcopy command. Below is a basic example of 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.
Note
By default, the basic xcopy command only copies files in the directory you specify as the source directory. You must use the /E option to copy subdirectories in the source directory as well.
Copy a directory and contents
xcopy c:\example c:\example2
In the example above, the directory "example" is copied into a new directory called "example2".
Copy the contents of a directory into another directory
Move to the directory where you want to copy the directories and subdirectories. In the example below, we are moving to the temp2 directory using the cd command.
cd\temp2
Once in the directory, use the xcopy command to copy another directory's subdirectories and contents. In the example below, we're copying the "temp3" contents into the "temp2" directory. Keep in mind that this does not copy the actual directory "temp3". Only the files and subdirectories in the temp3 directory are copied.
xcopy c:\temp3 /e
Once the steps above
are 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 example above, the directory "test" is copied into a new directory called "space test".
How to copy a directory to another drive
xcopy c:\test d:\test
In the example above, the "test" directory on the C: drive would copy to the "test" directory on the D: drive.
How to use the Windows command line (DOS).
Linux and Unix
To copy a directory with all subdirectories and files, use the 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 are available through the above cp link.
cp -r /home/hope/files/* /home/hope/backup
In the example above, the cp command would copy all files, directories, and subdirectories in the /home/hope/files directory to the /home/hope/backup directory.
What is an Operating System? » Computer Shortcut Keys and their Functions » Keyboard Function Keys » Computer Basics - Hardware - Software - Parts
Short Stories for Kids - Moral Stories – English Short Stories for Children - Moral Stories for Kids - Stories for Kids - Funny Story for Kids - Scary Stories for Kids - Really Funny Short Stories - Bedtime Stories
Proverb Stories
Powerful Motivational Quotes for Students » Success Quotes » English Short Stories for Kids
Cabin Crew Jobs & Career Advice » Secretary Job Description » Receptionist Job Description » Top 100 Interview Questions and Answers » How to Prepare for an Interview » How to Write a CV » How to Choose a Career » Computer Shortcut Keys and their Functions
Scholarships in Australia » Scholarships in Austria » Scholarships in Belgium » Scholarships in Canada » Scholarships in Germany » Scholarships in Ireland » Scholarships in Italy » Scholarships in Japan » Scholarships in Korea » Scholarships in Netherlands » Scholarships in Switzerland » Scholarships in UK » Scholarships in USA
Scholarships for Study in Africa » Scholarships for African Students » Undergraduate Scholarships » African Women Scholarships & Grants Scholarships for Study in Africa » Scholarships for African Students » Undergraduate Scholarships » African Women Scholarships & Grants Scholarships for Study in Africa » Scholarships for African Students » Undergraduate Scholarships »
Click here to post comments
Join in and write your own page! It's easy to do. How? Simply click here to return to Computer Basics FAQ.