I've been stuck on this for awhile and could use some help.
I'm trying to copy a large folder from a mapped network drive (A:) onto my local PC. I also need to exclude a subdirectory on that drive path called "Images". My current code (backup.bat) is below:
cd %HOMEPATH%\Desktop\%mydate%
xcopy "A:\PROGRA~2\QuadTech" 121\ /e /EXCLUDE:"A:\PROGRA~2\QuadTech\INSPEC~1\Images\"
Error I keep getting:
I've tried shortening the path with "dir /x" and I am sure the path name is correct. Also note that I need quotations as there are spaces in the PATH name.
Why am I getting errors when trying to Exclude this directory??
ANSWERED
I now have my Exclude statement point to my desktop where it reads a list of strings in a txt file.
xcopy "A:\PROGRA~2\QuadTech" 121\ /e /EXCLUDE:C:\Users\QuadTech\Desktop\excldelist.txt
Txt file contents:
\Images\
Remove the double-quotes around the name of the exclude file and you should be set! For filenames with spaces, you can use the 8-character version, e.g., PROGRA~1 for Program Files .
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.
Using /excludeList each string in a separate line in each file. If any of the listed strings match any part of the absolute path of the file to be copied, that file is then excluded from the copying process. For example, if you specify the string "\Obj", you exclude all files underneath the Obj directory.
The most important switches in this command are the /XD which allows you to exclude folders, and /XF that 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.
This is happening because the /EXCLUDE
option does not specify files to exclude.
It specifies files containing lists of files to exclude.
More info by typing xcopy /?
, though I am sure you know that.
(I know, I missed it too in the beginning; sometimes it is just a matter of having a second pair of eyes.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With