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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Command Line to copy files out of sub folders

Status
Not open for further replies.

bmacbmac

IS-IT--Management
Jan 26, 2006
392
US
Hi,
I have several thousand folders/subfolders in a structure like this:

base1
-0001
-0002
-0003
-0004
base2
-0001
-0002
-0003
-0004

etc. (where base is the folder and -000 are the subfolders)

I would like to get all of the files out of these subfolders that start with D*.*.

Does anyone know of a copy, xcopy, robocopy command to find all of the d*.* files and copy them without needing to go to each subfolder individually and issuing the copy d*.* command?

Thanks!
 
Wouldn't the following work?
robocopy source destination d*.* /s
 
Sorry, I should have been more descriptive. Yes /s would work, but I don't want the sub folders.

My goal is to get all of the d*.* files out of these subfolders and into one single folder.
 
What you can do is in two steps;
1. Perform a DIR D*.* /S > dfiles.txt
2. Create a batch file (using the FOR command) that would use dfiles.txt and run the copy/xcopy/robocopy command against it
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top