I have a network fileshare called \\SMWEB\MSDS
which contains hundreds of sub-directories named MSDSnnnn
(i.e., MSDS
plus a number).
Inside each sub-directory MAY be numerous files —
some .html
, .jpg
and various .pdf
files.
There may also be a sub-directory called _vti_cnf
,
which contains old FrontPage extensions associated with meta-data.
But there should always be at least one file within these sub-directories
with the name format MSDS#.PDF
.
(The number may be varying lengths;
e.g., MSDS99.PDF
or MSDS1099.PDF
, etc.)
There may also be old, outdated versions of these files which the owner appended an X#_
in front of the file (see the red box in the image — there are two archival versions of the MSDS0001.PDF
file in this example).
This is what the tree structure looks like:
Here's what I need to accomplish: I need to copy all of the current,
top-level PDF files somewhere
(a single directory called SDS
on my H:\
drive).
I do NOT want to replicate the sub-folders,
and I only want the files with the MSDS*.PDF
pattern.
(These files are highlighted in yellow in the above image.)
So I want to exclude:
- files in sub-directories under
MSDSnnnn
directories (e.g., in_vti_cnf
sub-directories), - files whose names don't begin with
MSDS
(e.g., theX#_
files), and - files whose names don't end with
.PDF
(e.g., HTML and JPEG files).
I tired the following command in Robocopy:
robocopy \\smweb\msds\ H:\SDS msds*.pdf /S /R:3 /W:3 /NDL /XJD /XD _vti_cnf
The problem is that Robocopy replicated the folder structure
on my H:
drive.
How can I accomplish my goal?
MSDS0002.PDF
under theMSDS0001
directory. (2) What should be done with file(s) in the_vti_cnf
directories?