View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Robert Crandal[_3_] Robert Crandal[_3_] is offline
external usenet poster
 
Posts: 161
Default Macro to copy files from Folders/Subfolders

"Gaura215" wrote:

I have a folder name as Output on my desktop, in which I want all excel
files gets copied, without any subfolders getting created in Output
folder. The name of the excel files if possible can be the path they got
copied from, so that i can easily differenciate as to which
folder/subfolder that excel file belongs to.


I have a possible solution that might not require the use of Excel VBA.

Using a DOS prompt or a cmd prompt, type the following command:

dir /b /s c:\2013\*.xls* c:\xcel_2013_file_list.txt

You might need to change the pathnames according to your system.

Okay, so this will give you a text file named "xcel_2013_file_list.txt".
Can you now create a script that reads each line in this file and copies
each source file to your target destination folder (using your own
filename choice)???

I hope that gets you going in the right direction.

Robert