Copy Folders and Subfolders Using Xcopy Command | 3 Ways🔥


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 Qiling 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

Can You Copy Folders and Subfolders Using Xcopy Command

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?

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 >>

How to Use Xcopy Command to Copy Folders and Subfolders

Key Takeaways:

  • 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.

  1. Case 1. Copy All Folders and Subfolders with Files
  2. Case 2. Copy Folders and Subfolders Without Files
  3. Case 3. Copy Folders and Subfolders with NTFS and Share Permission

Case 1. Copy All Folders and Subfolders with Files

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

copy all folders and subfolders with files

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:

Case 2. Copy Folders and Subfolders Without Files

Follow the command below to copy folders and subfolders without files.

Xcopy Source Destination /T /E

copy folders and subfolders without files

/T - Copies the subdirectory structure but not the files.

/E - Copies all subdirectories, including the empty ones.

Case 3. Copy Folders and Subfolders with NTFS and Share Permission

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

copy folders and subfolders with ntfs and share permission

/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.

Easier Way: Automatically Backup Files or Folders on Windows

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.

Qiling Disk Master 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 "Backup" tab page.

create file backup step1

Step 2. There are four data backup categories, File, Disk, OS, and Mail, click File bckup.

create file backup step2

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.

File backup

Step 4. Follow the on-screen guide, select the destination where you want to save the backup.

File backup step4

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.

Backup options

Step 5. You can store the backup to local drive, Qiling's cloud service, and NAS.

file backup step4

Step 6. Qiling Disk Master 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.

Step 7. Click "Proceed" 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.

File backup step7

You may also be interested in:

XCopy vs Robocopy Access Denied When Copying Files

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 Qiling Disk Master 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.

FAQs on Copy Folders and Subfolders Using Xcopy Command

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?

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.

Related Articles


Is this information helpful?     

What can we do to improve this information? (Optional)
Refresh Please enter the verification code!