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

How to copy files from more than one subfolder into a single folder?

Status
Not open for further replies.

feipezi

IS-IT--Management
Aug 10, 2006
316
0
0
US
Hello,
Would you happen to have some ready-made code to do the task in the Subject line?
I copied some code from Google.com but most of them are not working.
Like the following: the bug comes form the statements of "objFILE.Copy objEND": object required...

Dim objFSO
Dim objSTR, objEND, objTYP, objFILE
Dim Folder, SubFolder

objSTR = InputBox("source folder: ")
objEND = inputbox("dest. folder: ")

'For Each objFILE In objFSO.GetFolder(objSTR).Files
' objFILE.Copy objEND
'Next

Function srchSUBFOLD(Folder)
For Each SubFolder In Folder.subfolders
For Each objFILE In objFSO.getfolder(SubFolder.Path).Files
objFILE.Copy objEND
Next
Next
End Function

Call srchSUBFOLD(objFSO.getfolder(objSTR))

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top