w_wagner
asked on
DOS Wildcard for directory
I am looking for the proper syntax to use so that the xcopy command will skip over the * directory as it can have different names. Like:
XCOPY C:\temp /E /EXCLUDE:\inetpub\wwwroot\ *\subdir
XCOPY C:\temp /E /EXCLUDE:\inetpub\wwwroot\
Are you trying to explicitly exclude the "subdir" one level deep from wwwroot? Is the "subdir" name somewhat unique? I believe that the /exclude param of xcopy expects a file that contains patterns to match; from the help:
/EXCLUDE:file1[+file2][+fi le3]...
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.
So you may want to use something like \subdir\ if that would be unique. It also looks like you're missing the param to specify where you're copying C:\temp to? Best of luck!
/EXCLUDE:file1[+file2][+fi
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.
So you may want to use something like \subdir\ if that would be unique. It also looks like you're missing the param to specify where you're copying C:\temp to? Best of luck!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks. I'll give your suggetions a try.
What you could do is do a few commands in a BAT file before the XCOPY that would build the text file of all folders that matched the template you posted above. It can't be done with a simple wildcard like you tried, they aren't allowed in the middle of a path like that, but with a few more commands we could build the list of the directories you want to exclude. Could that work for you, a BAT file?
~bp