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

FileCopy all files 1

Status
Not open for further replies.

GP

IS-IT--Management
Jan 14, 2002
61
GB
I need to copy a few folders and files to a new location. How can I copy the all the files.

I tried

filecopy(strSrcDir & "pictures\*.*", strNewDir & "pictures\*.*")

but get the error "Run-time error '75': Path/File Access Error.

Any help.
 
GP:

The FileCopy method may not be able to use wildcard characters. Try using a specific file name. You may have to use "Dir" first and feed the results to this method. Or, you can use a command shell and perform a copy there using wildcard characters:

ID = Shell("CMD /C Xcopy C:\Data\Test\*.* C:\Data\Test2 /E")

Ron
 
Another way is to use the FileSystemObject of the scripting engine:
Set fso=CreateObject("Scripting.FileSystemObject")
fso.CopyFolder strSrcDir & "pictures\*.*", strNewDir & "pictures\"

Hope This Help
PH.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top