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!

slow file move using Scripting.FileSystemObject

Status
Not open for further replies.

ProfReynolds

Programmer
Sep 12, 2001
96
US
I am experiencing v-e-r-y slow copies from one XP machine to another. Especially when the file count approaches 200. Half of the files are 1KB or less, most of the rest <500KB, a few may reach 1.5MB.

I am using VBA to make the copy. I cannot DOS copy *.* because only a subset of the source folder files have been preselected.

Any ideas how to make it faster?

The relavent code section is:
Code:
Dim FileObj As Scripting.FileSystemObject
Set FileObj = New Scripting.FileSystemObject
for i=1 to n
   FileObj.MoveFile _
      "Z:\RemoteFolder\" + FileNameList(i), _
      "C:\LocalFolder\" + FileNameList(i)
next
 
You are moving the file. If you need a copy, see if .CopyFile() is faster.

Cogito eggo sum – I think, therefore I am a waffle.
 
Another version would be

for i=1 to n
Name "Z:\RemoteFolder\" + FileNameList(i) As "C:\LocalFolder\" + FileNameList(i)
next

without Scripting.FileSystemObject

I 'm quite interested in the result ....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top