Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Copy files not directory structure 1

Status
Not open for further replies.

xcelpro

Technical User
May 28, 2005
11
US
Hi all,

I am trying to copy specifiec files from all folders within a directory. Each file follows the naming convention RI_mm.dd.xls Where mm is 2 digit month and dd is 2 digit day

I do not want the directory structure copied, only the files
I cant seem to get this, all attempts to copy incl the dir structure

Thanks
w
 
Use Windows Search
Look for RI_??.??.xls
Select them all (Ctrl + C
Paste them to the destiny folder (Ctrl + v)

Cheers,
Dian
 
even having two explorer windows open, e.g. source directory and the other destination directory, and then Drag&Drop copies the whole DIR structure?

if what Dian posted does not work, then I believe that something is amiss on your system...

Ben
"If it works don't fix it! If it doesn't use a sledgehammer..."
How to ask a question, when posting them to a professional forum.
Only ask questions with yes/no answers if you want "yes" or "no"
 
I too would follow Dian's instruction remembering that file names with other values will also be found if they exist.

e.g. RI_ab.yz.xls.

So if necessary sort your results and eliminate unwanted files before copying.

sam


 
Thanks Dian,

Good stuff.
Once more I cannot see the trees for the forest.

Regards
x
 
have you tried the copy command? Robocopy might be a good choice also. Or finally, if you know how, write a vb.net or c# program that will copy what you need. Shopuldn't be too difficult to do.
 
Hi PRPhx,

Itried Copy/XCopy and looked at Robocopy
Probably my lack of knowledge
Directory strucutre like this
My docs
|-Reports
|-POS
|-xx.xx.xxxx [date]
|-RI_xx_xx.xls

I need all RI_xx_xx.xls file copied to C:\tmp
I then run some vba in Excel to copy drom Data tab in each workbook into one consolidated workbook for analysis and reporting

Thanks
x
 
Hmm.. Shouldn't be to difficult. The format for the copy command (from the command prompt, cmd) is:
copy source files destination files. In your case try: (assuming you have a folder called MyDocs on your C: drive and NOT the regular My Documents folder each user has)

copy C:\My docs\reports\POS\xx.xx.xxxx [date]\RI_xx_xx.xls
c:\tmp

(Notice there is a space between the xls and c:\tmp)

You can also use wildcards (The * Gets everything, the ? gets a single character)

This SOULD copy what you need! Once you figure it out, you can place the copy command inside of a batch file (.bat) and use the same command without having to retype it all the time.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top