By using this site, you agree to the Privacy Policy and Terms of Use.
Accept
10alert.com10alert.com
  • Threats
    • WordPress ThreatsDanger
    Threats
    A cyber or cybersecurity threat is a malicious act that seeks to damage data, steal data, or disrupt digital life in general. Cyber threats include…
    Show More
    Top News
    Morris Worm Turns 25
    8 months ago
    Meet the iPhone malware that tracks your every move
    8 months ago
    Virus can inflict physical harm onto a PC: myth or truth?
    8 months ago
    Latest News
    Triangulation: Trojan for iOS | Kaspersky official blog
    5 days ago
    Wordfence Intelligence Weekly WordPress Vulnerability Report (May 22, 2023 to May 28, 2023)
    5 days ago
    Safeguards against firmware signed with stolen MSI keys
    7 days ago
    WPDeveloper Addresses Privilege Escalation Vulnerability in ReviewX WordPress Plugin
    7 days ago
  • Fix
    Fix
    Troubleshooting guide you need when errors, bugs or technical glitches might ruin your digital experience.
    Show More
    Top News
    Why none of the Windows 8 upgrade guides you find will help
    8 months ago
    Windows 11 build 25188 outs with touch keyboard updates
    8 months ago
    How to upgrade from Windows 10 to Windows 11
    8 months ago
    Latest News
    How automatically delete unused files from my Downloads folder?
    4 months ago
    Now you can speed up any video in your browser
    4 months ago
    How to restore access to a file after EFS or view it on another computer?
    4 months ago
    18 Proven Tips to Speed Up Your WordPress Site and Improve SEO | 2023 Guide
    5 months ago
  • How To
    How ToShow More
    Nine years of Project Galileo and how the last year has changed it
    Nine years of Project Galileo and how the last year has changed it
    21 hours ago
    Dynamic data collection with Zaraz Worker Variables
    Dynamic data collection with Zaraz Worker Variables
    4 days ago
    Reduce latency and increase cache hits with Regional Tiered Cache
    Reduce latency and increase cache hits with Regional Tiered Cache
    5 days ago
    Cloudflare is deprecating Railgun
    Cloudflare is deprecating Railgun
    5 days ago
    What is two-factor authentication | Kaspersky official blog
    1 week ago
  • News
    News
    This category of resources includes the latest technology news and updates, covering a wide range of topics and innovations in the tech industry. From new…
    Show More
    Top News
    How to set parental controls on Windows 10?
    8 months ago
    How to use Shazam in curtain on Android?
    8 months ago
    How to Make Chrome Smoother
    8 months ago
    Latest News
    How to generate SSH keys on Windows 11
    11 hours ago
    How to enable file sharing on WSA for Windows 11
    11 hours ago
    How to add CPU, GPU, RAM widgets on Windows 11
    5 days ago
    How to create virtual drive (VHD, VHDX, Dev Drive) on Windows 11
    1 week ago
  • Glossary
  • My Bookmarks
Reading: How to exclude files and folders copy using Robocopy on Windows 11, 10
Share
Notification Show More
Aa
Aa
10alert.com10alert.com
  • Threats
  • Fix
  • How To
  • News
  • Glossary
  • My Bookmarks
  • Threats
    • WordPress ThreatsDanger
  • Fix
  • How To
  • News
  • Glossary
  • My Bookmarks
Follow US
NewsWindows

How to exclude files and folders copy using Robocopy on Windows 11, 10

Andra Smith
Last updated: 16 January
Andra Smith 5 months ago
Share
6 Min Read

On Windows 11 (or 10), Robocopy (Robust File Copy) is a powerful file management command-line tool with many options to transfer files and folders to another location faster and more reliably than File Explorer.

Contents
Exclude folder using RobocopyExclude file using RobocopyExclude files and folders using RobocopyRobocopy command switches

However, by default, Robocopy transfers everything on a given path, which may not be ideal in every scenario as you may have specific files and folders in a location you don’t want to copy. However, the tool includes a least two options, which you can use to exclude files and folders from a copy process.

In this guide, you will learn the steps to copy data using Robocopy on Windows 10 (or Windows 11), excluding those files and folders you don’t need to transfer.

  • Exclude folder using Robocopy
  • Eexclude file using Robocopy
  • Exclude files and folders using Robocopy

Exclude folder using Robocopy

To exclude a folder while copying with Robocopy, use these steps:

  1. Open Start on Windows 11.

  2. Search for Command Prompt, right-click the result, and select the Run as administrator option.

  3. Type the following command to copy the files and folders, excluding 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"

    This example excludes a specific folder 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 folder 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 folders 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"

Once you complete the steps, the data will copy to the destination, except the folders specified in the command (exclude_folder_file_robocopy) to be excluded.

Exclude file using Robocopy

To exclude a file while copying with Robocopy, use these steps:

  1. Open Start.

  2. Search for Command Prompt, right-click the result, and select the Run as administrator option.

  3. Type the following command to copy the files and folders, excluding 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"

    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 you complete the steps, Robocopy will copy all the files and folders from a particular location, excluding the files you specified in the command using the /XF switch.

Exclude files and folders using Robocopy

To exclude a file and folder using Robocopy, use these steps:

  1. Open Start.

  2. Search for Command Prompt, right-click the result, and select the Run as administrator option.

  3. Type the following command to copy the files and folders, excluding specific files and folders, to another drive and 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"

Once you complete the steps, all the content will copy to the new location except those files and folders you excluded in the command using the /XD and /XF switches.

Robocopy command switches

Robocopy has a lot of options, and in the command shown in this guide, we’re using the following switches to make copy data, excluding specific files and folders.

  • /E — Copy Subdirectories, including empty ones.
  • /Z — Copy files in restartable mode.
  • /ZB — Uses restartable mode. If access is denied, use backup mode.
  • /R:5 — Retry 5 times (you can specify a different number, the default is 1 million).
  • /W:5 — Wait 5 seconds before retrying (you can select a different number, the default is 30 seconds).
  • /TBD — Wait for share names To Be Defined (retry error 67).
  • /NP — No Progress – don’t display percentage copied.
  • /V — Produce verbose output, showing skipped files.
  • /XD — Excludes folders matching the path and folder name.
  • /XF — Excludes files matching the location and file name.

The most important switches in this command are the /XD which allows you to exclude folders, and /XF, which you can use to exclude files. The other options are optional, but you should use these options that you should use in any standard copy process using Robocopy.


Translate this article

TAGGED: Windows
Andra Smith January 16, 2023 December 27, 2022
Share this Article
Facebook Twitter Reddit Telegram Email Copy Link Print

STAY CONECTED

24.8k Followers Like
253.9k Followers Follow
33.7k Subscribers Subscribe
124.8k Members Follow

LAST 10 ALERT

How to generate SSH keys on Windows 11
News 14 hours ago
How to enable file sharing on WSA for Windows 11
News 14 hours ago
Nine years of Project Galileo and how the last year has changed it
Nine years of Project Galileo and how the last year has changed it
Apps 21 hours ago
Dynamic data collection with Zaraz Worker Variables
Dynamic data collection with Zaraz Worker Variables
Apps 4 days ago
How to add CPU, GPU, RAM widgets on Windows 11
News 5 days ago

Recent Posts

  • How to generate SSH keys on Windows 11
  • How to enable file sharing on WSA for Windows 11
  • Nine years of Project Galileo and how the last year has changed it
  • Dynamic data collection with Zaraz Worker Variables
  • How to add CPU, GPU, RAM widgets on Windows 11

You Might Also Like

News

How to generate SSH keys on Windows 11

14 hours ago
News

How to enable file sharing on WSA for Windows 11

14 hours ago
News

How to add CPU, GPU, RAM widgets on Windows 11

5 days ago
Threats

Triangulation: Trojan for iOS | Kaspersky official blog

5 days ago
Show More

Related stories

How to Use Cloudflare to Secure Your WordPress Site
How To Starting Chrome from the command line
How to fix error 0x80070057 in Chrome?
Windows 10 How To Disable Slide to Shutdown
Windows search not working (FIX)
How to watch movies and TV series for free on Kinopoisk?
Previous Next

10 New Stories

Reduce latency and increase cache hits with Regional Tiered Cache
Cloudflare is deprecating Railgun
Triangulation: Trojan for iOS | Kaspersky official blog
Wordfence Intelligence Weekly WordPress Vulnerability Report (May 22, 2023 to May 28, 2023)
Safeguards against firmware signed with stolen MSI keys
WPDeveloper Addresses Privilege Escalation Vulnerability in ReviewX WordPress Plugin
Previous Next
Hot News
How to generate SSH keys on Windows 11
How to enable file sharing on WSA for Windows 11
Nine years of Project Galileo and how the last year has changed it
Dynamic data collection with Zaraz Worker Variables
How to add CPU, GPU, RAM widgets on Windows 11
10alert.com10alert.com
Follow US

© 10 Alert Network. All Rights Reserved.

  • Privacy Policy
  • Contact
  • Customize Interests
  • My Bookmarks
  • Glossary
Go to mobile version
adbanner
AdBlock Detected
Our site is an advertising supported site. Please whitelist to support our site.
Okay, I'll Whitelist
Welcome Back!

Sign in to your account

Lost your password?