UtterAccess.com
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    
 
   
rsindle
post Aug 2 2016, 11:57 AM
Post#1


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


Hey,
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
Post#2


UtterAccess VIP
Posts: 20,952
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
 
doctor9
post Aug 2 2016, 01:19 PM
Post#3


UtterAccess Editor
Posts: 16,854
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.

Dennis
Go to the top of the page
 
rsindle
post Aug 2 2016, 01:22 PM
Post#4


UtterAccess VIP
Posts: 1,622
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,
R-
Go to the top of the page
 


Custom Search
RSSSearch   Top   Lo-Fi    29th March 2017 - 02:21 AM