Page Table of Contents
If you want to copy folders from one drive to another, you can use the Xcopy command line without copying each file manually. Follow this post from EaseUS to learn how to copy folders and subfolders using Xcopy command and a much easier alternative.
📃Also read: Robocopy Copy Folders and Subfolders on Windows
Xcopy, abbreviated as extended copy, is a command line to copy multiple files or complete directory trees from one location to another. Xcopy is the advanced version of the copy command, as this command comes with additional switches to specify the source and destination in detail. Xcopy removes the read-only attribute while sharing, which makes it ideal for copying files from a CDROM to a hard drive.
Many operating systems, like Windows, IBM PC, DOS, MS-DOS, etc., provide this command line utility. Even with the arrival of more advanced commands like Robocopy, many Windows users prefer using the Xcopy command. But can I use Xcopy Command to copy files and subfolders?
Yes, the Xcopy command lets you copy folders and subfolders. Since recreating the directory trees using the conventional copy-paste method is tedious, the Xcopy command helps you do it with just a command line using the source and destination.
Powershell Move Files from One Folder to Another
This article discusses how to use PowerShell commands to perform various operations to move files from one folder to another. Read more >>
- xcopy [source] [destination] [options]
- Xcopy C:\example D:\example /E /H /C /I
- Xcopy Source Destination /T /E
- Xcopy Source Destination /O /X /E /H /K
The common syntax to copy folders and subfolders with CMD is xcopy [source] [destination] [options]. We can use various options of the above command depending on our demands. Below are some of the cases we often perform using the Xcopy command.
- Case 1. Copy All Folders and Subfolders with Files
- Case 2. Copy Folders and Subfolders Without Files
- Case 3. Copy Folders and Subfolders with NTFS and Share Permission
First, you should open the Command Prompt in administrator mode. Click on "Start", type CMD, and select "Run as administrator".
After the Command Prompt is open, type the Xcopy command as shown to copy all folders and subfolders with files.
Consider an example folder, and you want to copy the "example" folder and its subfolders from the C drive to the D drive.
Xcopy C:\example D:\example /E /H /C /I
The respective commands mean:
/E - Copies all subdirectories, including the empty ones.
/H - Copies files with hidden and system file attributes.
/C - Continues to copy files even in case of errors.
/I - If in doubt, the command always assumes the destination is a folder. e.g. if the destination is not specified.
Point to remember:
- The Xcopy command won't copy open files.
- The command does not display any progress bar or completed notification when executed. You have to manually check if the files are copied correctly.
- If your folder name has spaces or is larger than eight characters, make sure you add quotation marks around the path while executing the command.
Follow the command below to copy folders and subfolders without files.
Xcopy Source Destination /T /E
/T - Copies the subdirectory structure but not the files.
/E - Copies all subdirectories, including the empty ones.
If you want to transfer the folders and subfolders with NTFS and share permission, type the below command and execute.
Xcopy Source Destination /O /X /E /H /K
/E - Copies all the folders and subfolders, including empty ones.
/H - Only copies the hidden and system files.
/K - Copies attributes. When used with Xcopy, it restes the read-only attributes.
/O - Copies the file ownership and ACL info.
/X - Copies file audio settings (implies /O).
Along with all these commands, there are many parameters you can use with Xcopy for various kinds of needs. However, a simple error will result in execution failure and may sometimes even lead to data loss. So, be cautious while using the command and parameters.
In many cases, you want to copy folders and subfolders for backup, but Xcopy can only make a folder duplication. If you want to copy files, folders, or hard drives for backup, you need reliable backup software. With a powerful and professional tool, you can even create a system backup to prevent system crash risks.
EaseUS Todo Backup is your complete backup and restore solution to replicate folders, disks, and systems for backup. It can help you automatically back up files on your Windows computers. With the help of advanced programs, you can clone, upgrade, and transfer files for backup. You can make clones for partitions, files, and systems to back up at any time.
In addition, the tool lets you mount the images for fast recovery. The ability to create a bootable backup helps you install your OS anywhere and anytime.
Here are the steps to help you back up files easily.
Step 1. Click the "Select backup contents" button to start backup.
Step 2. There are four data backup categories, File, Disk, OS, and Mail, click File.
Step 3. Both local and network files will be listed on the left. You can expand the directory to select the files to be backed up.
Step 4. Follow the on-screen guide, select the destination where you want to save the backup.
Click "Options" to encrypt the backup with password in "Backup Options", set the backup schedule and choose to start back up at certain event in "Backup Scheme". There are also many other options you can explore, customize the backup task according to your need.
Step 5. You can store the backup to local drive, EaseUS's cloud service, and NAS.
Step 6. EaseUS Todo Backup enables users to back up data to both third-party cloud drive and its own cloud drive.
If you want to back up data to third-party cloud drive, choose Local Drive, scroll down to add Cloud Device, add and login your account.
You can also choose EaseUS's own cloud drive. Click EaseUS Cloud, sign up with your EaseUS Account and log in.
Step 7. Click "Backup Now" to start backup. After the backup task is completed, it will be displayed in the form of a card on the left side of the panel. Right-click the backup task to further manage it.
You may also be interested in:
To Wrap Things Up
Xcopy is a useful option to simply move/copy files between two locations on your computer. The above post helps you learn how to copy folders and subfolders using Xcopy command in various situations. However, many users complain of the Xcopy command failing or not working frequently.
A reliable option like EaseUS Todo Backup helps you automatically copy files from one folder to another. It has the ability to copy folders, subfolders, hard drives, and systems. With advanced backup and cloning options, it acts as a complete solution for backup and recovery needs.
Here are some of the most frequent FAQs asked on how to copy folders and subfolders using the Xcopy command. I hope you find these queries helpful.
1. How to copy shared folders without losing share permissions?
- Open File Explorer, go to the shared folder and right-click on it.
- Navigate to Properties > Security Tab > Advanced > Change Permissions. Here, uncheck the "Include inheritable permissions from this object's parent" and click "Add". Now, click OK thrice to save it.
- Change the parent directory of the shared folder.
- Run the Xcopy command with /E/H/K/O/X to copy shared folders without losing share permissions.
2. What command can copy all files directories and subdirectories to another disk all at once?
The Xcopy command can copy all file directories and subdirectories to another disk all at once. The command comes with a set of attributes for specific functions to complete the required task.
3. Should I use Xcopy or Robocopy?
That's a debatable question. One can consider Robocopy as a more advanced version of Xcopy. The major difference between Xcopy and Robocopy is that Robocopy has a retry option, whereas Xcopy does not.
Was this page helpful? Your support is truly important to us!
EaseUS Todo Backup
EaseUS Todo Backup is a dependable and professional data backup solution capable of backing up files, folders, drives, APP data and creating a system image. It also makes it easy to clone HDD/SSD, transfer the system to different hardware, and create bootable WinPE bootable disks.
Updated by"I hope my articles can help solve your technical problems. If you are interested in other articles, you can check the articles at the bottom of this page, and you can also check my Facebook to get additional help."…Read full bio
EaseUS Todo Backup
Smart backup tool for your files, disks, APPs and entire computer.