Robocopy Copy Folders and Subfolders on Windows | How-to Guide  

How to Use Robocopy Command to Copy Folders and Subfolders


If you're struggling to copy or move large folders and subfolders from one drive to another, this article has a solution. Instead of using Xcopy, you can use Robocopy commands to copy folders and subfolders on Windows. This technique will be discussed in detail, and a third-party tool will also be introduced to automatically back up files.

Can You Move Folders and Subfolders Using Robocopy

Robocopy command for making an exact copy
byu/Qbccd insysadmin

The Robocopy command is a popular tool for copying files and folders, and many users on Reddit are looking for a straightforward way to use it. The basic syntax for copying files and folders with Robocopy is: robocopy [source] [destination] [/copy:] [/move:] [/mirror:] [/movex:]

Robocopy, a command line utility on Windows, allows for the seamless transfer of folders and subfolders between drives, making it ideal for moving large datasets that would otherwise take a long time using other methods.

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. This is accomplished by typing specific commands on Command Prompt.

You can use the following Robocopy command to copy folders and subfolders: `robocopy C:\Source C:\Destination /S /Z /LOG:C:\log.txt`

or

We can break down this command as follows.

To copy folders and subfolders using Robocopy, you can use the command with the /MIR option, which stands for mirror. This option will copy the contents of the source folder to the destination folder, including all subfolders and files, and will also delete any files or folders in the destination that are not present in the source.

Xcopy is a command-line utility that allows you to copy files and folders, including their subfolders, with a simple syntax. It can be used in various scenarios, such as copying a single folder, multiple folders, or even an entire directory tree, and can be customized to suit specific needs, like copying files with specific extensions or dates.

Copy Folders and Subfolders Using Xcopy Command

You can learn about Xcopy, a command used to copy folders and subfolders, and how to use it in various scenarios through this post. 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 move data and leave nothing in the source drive, you can use the "Move" command. The "Copy" command is used when you want to retain the original data, while the "Move" command is used when you want to remove the original data. This can be applied in different scenarios.

  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, launch Command Prompt as an administrator and use the command `robocopy C:\Source C:\Destination /MIR /COPYALL /Z /LOG:C:\robocopy.log`, replacing "C:\Source" and "C:\Destination" with the actual paths to the source and destination folders. This command will mirror the source folder to the destination, preserving permissions and copying all file and folder attributes.

robocopy C:\src E:\dst

use the command below

You can copy all files, including NTFS ACLs, folders, subfolders, and other file attributes, by adding the "/E" command option to select all empty subfolders and the "/COPYALL" command option to copy any other file component. This allows you to copy multiple files.

To copy all folders and subfolders, use the following Robocopy command: `robocopy "C:\Source\folder" "C:\Destination\folder" /MIR /COPY:DAT /DCOPY:T /LOG:"C:\Destination\folder\robocopy.log"`.

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

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

Note: To create a batch file that copies all files from the "src" folder to the "dst" folder on the "C" drive, you can use the following commands: `@echo off` `copy /-y C:\src\*.* C:\dst` `pause`.

Case 2. Robocopy Move Folder and Subfolders

To maintain only copies of your files in the destination folder, you can use the "MOV" command with Robocopy, which will delete files in the source folder and move copies to the target drive. A sample command to move folders (without subfolders) from the source to the destination drive is: `robocopy "source folder" "destination folder" /mov /s` (Note: The `/s` option is used to move folders without subfolders).

robocopy C:\src E:\dst /MOV

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

The command `move C:\*.* E:\` will move all files from drive C to drive E. It's essential to replace "C" and "E" with the actual drive letters on your computer.

In addition to the "MOV" command option, you can use the "MOVE" command to transfer all files and folders, excluding subfolders and other file attributes. This command is useful for transferring files and folders without the need to specify each item individually. The "MOVE" command is a more straightforward way to move files and folders, whereas the "MOV" command option requires more specific details. By using the "MOVE" command, you can easily move files and folders without worrying about excluding subfolders and other file attributes.

robocopy C:\src E:\dst /MOVE

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

The Robocopy MOVE command is used 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

Robocopy allows you to move files over a network, but you may encounter network interruptions. To address this, you can use the "/Z" command option, which restarts file transfer if it stalls due to network downtime. This ensures that your file transfer process is not interrupted and can continue smoothly.

To prevent file transfer failures, you can use Robocopy with the "/FFT" command option to preserve file timestamps while copying files over a network. This allows for a seamless file transfer process, and the command can be used to easily copy files across a network.

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

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

Robocopy will copy files over a network server while preserving file timestamps and preventing network interruptions.

To add an inter-packet gap option to the Robocopy command, you can include the "/IPG" switch followed by a time value in milliseconds. This allows Robocopy to pause between sending packets, potentially improving network performance and reducing congestion. For example, you could use the command "robocopy source destination /IPG:500" to specify a 500-millisecond pause between packets. This can be particularly useful in high-traffic network situations where packet congestion is a concern.

For All: Backup Files Automatically Instead of Copying🔥

Instead of using Robocopy to manually copy files from one drive to another for backup, you can use backup software like Qiling Disk Master to automate the process. This free tool allows you to back up all your data with just a few clicks.

Qiling Disk Master allows you to back up your drives or files to different locations, including the cloud, network, external drives, NAS, or local drives, with a reliable automatic process, and easily restore backups to the same or different device.

Qiling Disk Master

  • One-click backup and quick recovery with high efficiency
  • Create a Windows system image on a USB drive
  • Perform disk imaging or cloning in just several clicks
  • Get 250G free cloud storage and back up your files to the cloud with a simple and secure service.
  • Perform full, incremental, and differential backups

To back up all data on your PC's drives, download and use Qiling Disk Master, a free software that can be upgraded to a premium version for more 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. 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 displayed, allowing you to browse and select the desired backup files from the directory.

File backup

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

File backup step4

To encrypt the backup with a password, click on "Options" in the "Backup Options" menu, then select the desired encryption method. Next, click on "Backup Scheme" to choose the backup schedule and specify the start event. Additionally, you can customize the backup process by selecting other available options.

Backup options

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

file backup step4

Step 6. Qiling Disk Master allows customers to back up data to both a third-party cloud drive and its own cloud drive.

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

Step 7. Click Proceed to start a backup job, which will be displayed as a card on the panel once completed. The backup job can then be further managed by right-clicking on it.

File backup step7

To Wrap Things Up

You can use the command line to copy folders and subfolders on Windows using Robocopy, a powerful utility that also allows you to move folders and subfolders seamlessly. Additionally, Robocopy enables you to copy files over a network, provided your PC has an internet connection, making it a versatile tool for managing files and folders.

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, download and install it on your PC.

Use Robocopy to Copy Folder and Subfolders FAQs

Robocopy is a Windows utility that allows users to copy all files and folders. Below are frequently asked questions about using Robocopy for this purpose.

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

The /S, /E, and /T switches in Xcopy or Robocopy allow for different subdirectory handling options. /S copies only occupied directories, /E copies all directories including empty ones, and /T copies the directory structure without files.

2. What Is Faster Robocopy or Xcopy?

Robocopy is a faster alternative to Xcopy, offering a retry option in case of errors during file transfer, whereas Xcopy does not. This makes Robocopy a more efficient option, eliminating the need to repeat copying data if errors are encountered.

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 with Robocopy, it only copies files that have different attributes (size and time stamps) between the source and destination, skipping files with similar attributes.

Related Articles


Is this information helpful?     

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


QilingTech uses cookies to ensure you get the best experience on our website.  Learn more  Got it