How to Use Robocopy Command to Copy Folders and Subfolders


If you're stuck on how to copy or move large folders/subfolders from one drive to the other, you shouldn't look any further. This article from Qiling will discuss an easier technique to apply to copy files instead of using Xcopy. Using specific commands, you'll learn how to Robocopy copy folders and subfolders on Windows. We'll also introduce a third-party tool that you can use to back up files automatically.

Can You Move Folders and Subfolders Using Robocopy

Robocopy command for making an exact copy
byu/Qbccd insysadmin

This is a hot topic on Reddit: How do you copy files and folders using the Robocopy command?

Robocopy (Robust File Copy) is a command line utility on Windows that allows you to move folders and subfolders between drives. Robocopy is important for copying large datasets that would take longer when using other techniques. With this utility, you can move/copy folders and subfolders seamlessly.

'Moving' folders using Robocopy means that no copy of the file will be left in the source drive, while 'copying' folders will leave a copy in the source drive. Moving or copying files from the source to the destination directory using Robocopy is accomplished by typing specific commands on Command Prompt.

Below is a Robocopy command that you can use to copy folders and subfolders:

or

We can break down this command as follows.

In the next section, we'll show you how to use Robocopy command to copy folders and subfolders.

In this post, you can learn what Xcopy is and how to copy folders and subfolders via the Xcopy command in various use cases.

Copy Folders and Subfolders Using Xcopy Command

In this post, you can learn what Xcopy is and how to copy folders and subfolders via the Xcopy command in various use cases. Read more >>

How to Copy Folders and Subfolders Using Robocopy

Robocopy allows you to either copy or move folders/subfolders between drives. If you want to retain a copy of the data on the source drive, using the "Copy" command is appropriate. However, if you want to copy data and leave nothing in the source drive, you can use the "Move" command. Below is how you can apply the two cases.

  1. Case 1. Robocopy Copy Folder and Subfolders
  2. Case 2. Robocopy Move Folder and Subfolders

Case 1. Robocopy Copy Folder and Subfolders

To Robocopy copy folders and subfolders with permissions on your Windows PC, you'll first need to launch Command Prompt as an administrator. If you want to copy folders only and exclude subfolders, you can use the command below:

robocopy C:\src E:\dst

use the command below

You can also copy all files, including NTFS ACLs, folders, subfolders, and other file attributes. To achieve that, you'll need to add the "/E" command option to select all empty subfolders. Next, you can add the "/COPYALL" command option to copy any other file component (multiple files).

Check out the complete Robocopy command below to copy all folders and subfolders:

robocopy C:\src E:\dst /E /COPYALL

type robocopy C:\src E:\dst /E /COPYALL

Note: Ensure you replace "C" and "E" with the correct drive letters, while "src" and "dst" should represent the exact folder/subfolder names.

Case 2. Robocopy Move Folder and Subfolders

If you want to only maintain copies of your files in the destination folder, you can use the "MOV" command. This will delete files in the source folder and move copies to the target drive. Below is a Robocopy command to move folders (without subfolders) from the source to the destination drive:

robocopy C:\src E:\dst /MOV

type robocopy C:\src E:\dst /MOV

The above command will help move files from the "C" drive to the "E" drive. Please replace the drive letters above with the correct ones on your PC.

In addition to the "MOV" command option, you can use the "MOVE" command (note the difference) to transfer all files and folders. This command won't exclude subfolders and other file attributes as the previous command. Check it out below:

robocopy C:\src E:\dst /MOVE

type robocopy C:\src E:\dst /MOVE

The Robocopy MOVE command applies when you want to delete any files from the source drive and only maintain copies in the destination drive.

Share this blog on your social platforms to help others if you find it useful.

How to Use Robocopy to Copy Files Over Network

With Robocopy, it's also possible to move files over a network. However, one challenge with this method is that you may encounter a network interruption anytime. To address this, Robocopy allows you to use the "/Z" command option to restart file transfer if it has stalled midway (following a network downtime).

Therefore, this will prevent the transfer from failing. Additionally, Robocopy allows you to add the "/FFT" command option to preserve file timestamps while copying files via a network. Check out the command below to easily copy files over a network:

robocopy C:\src \\SRV1\share /Z /FFT

type robocopy C:\src \\SRV1\share /Z /FFT

The above command will allow Robocopy to share your files over a network server and prevent network interruption (/Z) while preserving file timestamps (/FFT).

In addition to the above command, you can add the "/IPG" switch command to specify the inter-packet gap option. This ideally means the wait time Robocopy will have to apply between sending simultaneous packets.

For All: Backup Files Automatically Instead of Copying🔥

Instead of copying files from one drive to another using Robocopy to create a backup, you can do that automatically using backup software. One software that we highly recommend for such tasks is Qiling Disk Master. This free backup tool can back up all your data in just a few clicks.

It allows you to back up your drives or files to different locations, including the cloud, the network, external drives, NAS, or local drives. There's no room for losing your files during the automatic backup process since Qiling is quite reliable. Whenever you need to access the backups, Qiling Disk Master allows you to restore them easily. You can retrieve the backup data to the same or different device.

Qiling Disk Master

Do you want to seamlessly back up all the data on your PC's drives? Ensure you use Qiling Disk Master. You'll just need to download a free version of the software, and you're good to go. You can upgrade to the premium version anytime for more advanced features.

Step 1. To initiate a backup, click the Select backup contents option.

create file backup step1

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

create file backup step2

Step 3. On the left, both local and network files will be shown. You may extend the directory to pick the backup files.

File backup

Step 4. Follow the on-screen instructions and choose a location to store the backup.

File backup step4

Click Options to encrypt the backup with a password in Backup Options, then click Backup Scheme to specify the backup schedule and start the backup at a certain event. There are also other additional choices you may choose to tailor the backup process to your requirements.

Backup options

Step 5. The backup may be stored on a local disk, Qiling' online service, or NAS.

file backup step4

Step 6. Qiling Disk Master enables customers to back up data to a third-party cloud drive as well as its own cloud drive.

If you want to back up data to a cloud drive provided by a third party, choose Local Drive, scroll down to add Cloud Device, and then add and log in to your account.

Step 7. Click Proceed to begin the backup process. The backup job will be presented as a card on the left side of the panel after it has been finished. Right-click the backup job to handle it further.

File backup step7

To Wrap Things Up

This article has shown you how to use the command line to Robocopy copy folders and subfolders on Windows. In addition to copying, Robocopy allows you to move folders and subfolders seamlessly. Also, copying files over a network is possible, provided your PC has an internet connection.

If you want an alternative way to back up your files automatically instead of copying, you should try Qiling Disk Master. This third-party data backup software allows you to quickly save your files to different locations and recover them when needed. To get started with Qiling backup software today, ensure you download and install it on your PC.

Use Robocopy to Copy Folder and Subfolders FAQs

Below are frequently asked questions about Robocopy copy all files and folders on Windows.

1. What Switch Do You Use with Xcopy or Robocopy to Copy Subdirectories?

You'll use the /S /E /T switch to copy subdirectories with Xcopy or Robocopy. Here, /S will copy only the occupied directories; /E copies everything, including empty and occupied directories; while /T will copy the directory structure excluding the files.

2. What Is Faster Robocopy or Xcopy?

Robocopy is considered a faster alternative to Xcopy. Generally, Robocopy offers a retry option in the event you encounter errors during the file transfer process, while Xcopy doesn't offer that. This makes it a faster option since you won't have to repeat copying data if you encounter errors.

3. What Are the Disadvantages of Robocopy?

The main disadvantages of Robocopy include the following:

Although it has some disadvantages, Robocopy is still useful.

4. Does Robocopy Copy Everything?

When copying files between folders or drives, Robocopy will only copy those whose source and destination have different attributes, i.e., size and time stamps. Therefore, Robocopy will skip files with similar attributes in the source and destination folders.

Related Articles


Is this information helpful?     

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