Computing.Net > Forums > Programming > Copy from multiple directories

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Copy from multiple directories

Reply to Message Icon

Name: skisalomon77
Date: February 20, 2008 at 08:27:17 Pacific
OS: XP Pro
CPU/Ram: Intel 2.4 GHz and 2GB
Product: Dell Optiplex
Comment:

I want to copy files from multiple directories without creating the directory tree. XCOPY /S gets all the files I need, but creates the tree as well. I have 100 subdirectories and every folder contains files beginning with TZ00. I want to copy all of the TZ00 files from every subdirectory into a new folder without creating the directory tree. Is there a way to do this without having to create a batch file containing a copy command for every folder? I don't want to worry about updating the batch file every time I add a new subdirectory.



Sponsored Link
Ads by Google

Response Number 1
Name: klint
Date: February 20, 2008 at 08:40:51 Pacific
Reply:

for /r %d in (.) do copy %d\TZ00* \destination


0

Response Number 2
Name: skisalomon77
Date: February 20, 2008 at 09:01:27 Pacific
Reply:

Awesome...thanks klint! I realized I needed %% before each d to get it to work in a batch.


0

Response Number 3
Name: klint
Date: February 20, 2008 at 09:07:22 Pacific
Reply:

Yes - I just typed that on the command line to check it. I must remember in future to point out that you need two %% in a batch file.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Copy from multiple directories

Copy images from sub directories www.computing.net/answers/programming/copy-images-from-sub-directories/16169.html

Batch file to copy from network dri www.computing.net/answers/programming/batch-file-to-copy-from-network-dri/14488.html

Copy files by date modified www.computing.net/answers/programming/copy-files-by-date-modified/15932.html