Copying And Moving Multiple Files

Dinsdale

Junior Member
Jun 24, 2004
9
0
0
I have a list of file names in an Excel spreadsheet, listed in a column.

I need to use this list to find files in various folders on a server, and copy these files to a new folder so I can burn a CD-R.

This could be done manually, of course, but I have nearly 1,000 file names to locate, and copy to one central location for the CD-R.

Any suggestions?

A shareware utility? Or a script of some sort? How can I do this?

It can't be THAT hard!

Thanks.
 

WW

Golden Member
Jun 21, 2001
1,514
0
0
something like this would work...but probably would take a long time to run:

in Excel, make a macro like the following. Assume your spreadsheet is called sheet1, and your filenames are in a1 to a1000. (change the code accordingly for your data). Change the 'lookin' path to your server path. create a folder called cdrtemp on C: to hold the copied files...

this assumes that the filenames are unique (ie appear once on your server) this will only copy the first instance of the found filename....if not, you'll need to cycle through the foundfiles....

good luck,

ww

here's the visual basic code:


Sub findandcopy()

For Each C In Worksheets("Sheet1").Range("A1:A1000")

With Application.FileSearch

.LookIn = "C:\"
.SearchSubFolders = True
.Filename = C
.MatchTextExactly = True
.Execute
FileCopy .FoundFiles(1), "c:\cdrtemp\" & .Filename

End With

Next C

End Sub