“I’d like to copy files and folders in a directory to another folder excluding a list of files and folders. Run this command: xcopy c:\t1 c:\t2 /EXCLUDE: /My Music /My Pictures’ without quotes but with no luck. It keeps saying ‘can’t read files: /My Music /My Photos’. Is that even possible to make xcopy exclude folders or files while copying? If yes, what should I do to achieve?”
Xcopy, a useful Windows command, allows you to copy files and directories including subdirectories to another place. Microsoft also provides many xcopy command examples for users in different situations. However, some users find xcopy does not exclude files that were written behind EXCLUDE command, or the files cannot be read.
Then, what is the proper way of letting xcopy exclude files in folder when copying?
How to Let XCopy Exclude Folders and Files?
According to Microsoft, /exclude specifies a list of files containing strings. Each string should be in a separate line in the files. When any of the strings match any part of the absolute path of the file to be copied, that file will be excluded from being copied. For example, specifying a string like \obj\ or .obj will exclude all files underneath the directory obj or all files with the .obj extension respectively.
To be specific, you need to write all files that need to be excluded in separate line in a text file, and name it. Write the FULL PATH instead of the NAME of the text file next to the command /exclude. Here is an example based on the user in the case at the beginning.
1. Create a text file and name it with MyExclusion for example, regardless of the location.
2. Open the text and write the files’ name you’d like to exclude in a separate line like this (without bullets) to make xcopy exclude multiple folders.
3. Run the command now: xcopy c:\t1 c:\t2 /EXCLUDE: C:\mybatch\MyExclusion.txt and press Enter.
It is quite easy to copy files and exclude some certain files and folders with xcopy. Nevertheless, except for the xcopy exclude specific folder issue, there are many other xcopy problems like xcopy invalid path, xcopy access denied, and xcopy unable to create directory, etc. are discussed. That’s why so many people are looking for Xcopy alternative on the Internet. As a matter of fact, we have easier way to let Windows backup exclude files during copying.
Exclude Folders and Files from Windows Backup with Easier Way
To exclude certain files in folders or just folders in directory while copying, AOMEI Backupper Professional comes to help. You are allowed to include or exclude specific files or folders with file extensions or wildcards. In addition, you have choice to exclude hidden and system files and folders at the same time.
File backup and file sync are available in AOMEI Backupper, so it is quite easy no matter for file moving or later restoring. You can back up or sync files to lots of destinations such as (Seagate) external hard drive, USB flash drive, SD card, CD/DVD disc, NAS, network share, Cloud drive, and so on.
It has a lucid graphical user interface and also gives the way to schedule backup or sync. Real-time file syncing is provided as well. Windows 10/8/7/XP/Vista are supported and you may want to have a try now.
To exclude folders from Windows backup:
1. Get the free trial, install and run AOMEI Backupper. Connect the external destination storage to your PC in advance if necessary.
2. Click Backup tab and then scroll down to find File Sync. Press it.
3. Edit the task name if needed. Click Add Folder.
4. Click Browse to choose the files and folders you’d like to sync. Next, click the double down arrow to open Filter settings.
5. Now, you come to the step to add files you’d like to exclude (the files should be included in the selected folder). Click OK after the configuration.
6. Select the destination you’d like to copy files to and then click Start Sync.
Sync Options: write a comment for current task and enable email notification here.
Schedule: set daily, weekly, monthly, event triggers and real-time sync here.
AOMEI Backupper Professional also supports clone operating system to SSD, clone hard drive to SSD, backup system to USB drive, backup external hard drive, and more. More importantly, these operations can be done in Command Prompt.
You can let xcopy exclude folders or files in folder while copying from one directory to another with simple steps. Likewise, you have better choice to do exclusion during file backup or file syncing with a comprehensive tool. As a robust backup solution, AOMEI Backupper earns good reputation among millions of users and many famous websites like CNET. Go for it to add extra layer of protection for your computer.