Clear, practical technology insights About · Contact

How to Exclude Files and Folders with Robocopy in Windows 10

Learn how to Exclude Files and Folders with with clear steps, useful examples, and practical tips. Complete the task correctly and avoid common mistakes.

Author: Lesley Montoya5 minutes read
Table of Contents

This updated guide explains how to Exclude Files and Folders with Robocopy in Windows 10 through clear steps, practical examples, and important checks that help prevent common errors.

In this guide, you'll learn the steps to copy data with Robocopy on Windows 10, except for unnecessary files and folders.

How to Exclude Directories with Robocopy

To exclude a folder while copying using Robocopy, use the following steps:

1. Open Command Prompt with admin rights.

2. Enter the following command to copy files and folders, except for a specific folder, to another location and press Enter:

robocopy C:sourcefolderpath D:destinationfolderpath /E /Z /ZB /R:5 /W:5 /TBD /NP /V /XD "C:sourcefolderpathtoexclude-folder"
Exclude Files and Folders with Robocopy in Windows 10 — How to Exclude Directories with Robocopy screenshot 1 How to exclude directories with Robocopy

This example excludes a specific directory using Robocopy:

robocopy C:sourcefolderpath D:destinationfolderpath /E /Z /ZB /R:5 /W:5 /TBD /NP /V /XD exclude-folder-1

This example excludes a directory using the Robocopy wildcard option:

robocopy C:sourcefolderpath D:destinationfolderpath /E /Z /ZB /R:5 /W:5 /TBD /NP /V /XD exclude-fold*

This example excludes multiple directories using Robocopy:

robocopy C:sourcefolderpath D:destinationfolderpath /E /Z /ZB /R:5 /W:5 /TBD /NP /V /XD "C:sourcefolderpathtoexclude-folder-1" "C:sourcefolderpathtoexclude-folder-2"

When you complete the steps, all data from the path will be copied, except for the directories you specified in the exclude_folder_file_robocopy command .

How to Exclude Files by Robocopy

To exclude a file while copying using Robocopy, follow these steps:

1. Open Command Prompt with admin rights.

2. Enter the following command to copy files and folders, except for a specific file, to another location and press Enter:

robocopy C:sourcefolderpath D:destinationfolderpath /E /Z /ZB /R:5 /W:5 /TBD /NP /V /XF "C:sourcefolderpathtofolderfilename.extension"
Exclude Files and Folders with Robocopy in Windows 10 — How to Exclude Files by Robocopy screenshot 2 How to exclude files by Robocopy

This example excludes a file using Robocopy:

robocopy C:sourcefolderpath D:destinationfolderpath /E /Z /ZB /R:5 /W:5 /TBD /NP /V /XF filename-1.extension

This example excludes a file using the Robocopy wildcard option:

robocopy C:sourcefolderpath D:destinationfolderpath /E /Z /ZB /R:5 /W:5 /TBD /NP /V /XF filena*

This example excludes multiple files using the Robocopy option:

robocopy C:sourcefolderpath D:destinationfolderpath /E /Z /ZB /R:5 /W:5 /TBD /NP /V /XF "C:sourcefolderpathtofolderfilename-1.extension" "C:sourcefolderpathtofolderfilename-2.extension

After completing the steps, Robocopy will copy all files and folders from a specific location, except for the files you specified in the command using the / XF switch .

How to Exclude Files and Folders with Robocopy

To exclude both files and folders using Robocopy, use the following steps:

1. Open Command Prompt with admin rights.

2. Enter the following command to copy all files and folders, except for certain files and folders, to another drive, then press Enter:

robocopy C:sourcefolderpath D:destinationfolderpath /E /Z /ZB /R:5 /W:5 /TBD /NP /V /XD "C:sourcefolderpathtoexclude-folder" /XF "C:sourcefolderpathtofolderfilename.extension"
Exclude Files and Folders with Robocopy in Windows 10 — How to Exclude Files and Folders with Robocopy screenshot 3 How to exclude files and folders with Robocopy

When you complete the steps, all the content will be copied to the new location, in addition to the files and folders you excluded in the command using the / XD and / XF switches .

Frequently Asked Questions

What is the easiest way to Exclude Files and Folders with Robocopy in Windows 10?

Start with the requirements in this guide, then follow each step in order. Check the result after every major change so problems are easier to identify.

Can beginners follow these instructions?

Yes. The process is organized into practical steps, and you can repeat any step before moving forward.

What should I check if the method does not work?

Confirm your software or device version, permissions, settings, file format, and internet connection when the task depends on online services.

Was this article helpful?

Your feedback helps us improve.

Discussion

Reader Comments 0

Sign in with email or Google to join the discussion.