X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
   Reply to this topicStart new topic
> Copy Multiple Files Within Directory Tree To Single Folder, Any Versions    
post Aug 2 2016, 11:57 AM

UtterAccess VIP
Posts: 1,642
Joined: 25-June 04
From: Northern Virginia

I'm looking for someone with DOS script/batch file skills that can help with this.
I want to copy all .xls and .xlsx files beneath a single folder (in multiple, multiple folders) to a single folder (without reproducing the folder structure).
So if there are 100 Excel files somewhere below C:\MyFoldersWithExcelFiles I can copy them All to C:\FlattenedOutFolderOfExcels

(All filenames will be unique, so we don't have to worry (too much) about overwriting files).

From the source folder (C:\MyFoldersWithExcelFiles) I have tried:

Xcopy /s *.xls? C:\FlattenedOutFolderOfExcels

I get all the files i want, but the folder structure gets reproduced.
Is there a quick-and-dirty DOS command to use?
Thanks in advance.
Go to the top of the page
Doug Steele
post Aug 2 2016, 01:03 PM

UtterAccess VIP
Posts: 21,312
Joined: 8-January 07
From: St. Catharines, ON (Canada)

AFAIK, there's nothing built into DOS that would let you do that.

I think you'll have to write code to traverse the tree, finding each file, and explicitly copying it.
Go to the top of the page
post Aug 2 2016, 01:19 PM

UtterAccess Editor
Posts: 17,609
Joined: 29-March 05
From: Wisconsin

In addition to Doug's recommendation, I'd also add that you will probably want to be able to handle things like two files in different folders but with the same file name.

Go to the top of the page
post Aug 2 2016, 01:22 PM

UtterAccess VIP
Posts: 1,642
Joined: 25-June 04
From: Northern Virginia

Filenames should have been unique. (but you never know).
I have code that I could use that I can tweak to do this, but was looking for a quick-and-dirty.
Thanks all,
Go to the top of the page

Custom Search
RSSSearch   Top   Lo-Fi    22nd September 2017 - 10:52 PM