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

Copying all files from one directory to another 1

Status
Not open for further replies.

rockfish12

Technical User
Feb 12, 2002
31
US
How could I copy all files from one directory to another...for instance, from my CD drive (d:) to my hard drive (c:)? (I've read that there may be some FileCopy function, which I tried, but Access 2000 didn't seem to recognize it. I even looked for it in VBA help, but it was nowhere to be found)


 
Sub CopyFiles()

'if you set a reference to the Microsoft Scripting Runtime
'Library from Tools ... Reference menu then you can simply
'use Dim FSO as FileSystemObject
'Else you can use the following two lines
Dim FSO
Set FSO = CreateObject("Scripting.FileSystemObject")
'Create this would copy contenst of Test1 into Test2
FSO.CopyFolder "c:\mydocuments\Test1\*", "c:\mydocuments\Test2\"

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top