Re: File System Object network overhead by John
John
Mon Feb 09 21:58:45 CST 2004
Well, I'm not accessing the file itself, just the file.DateLastModified
property, like...
dim fso, f, fl, fc
set fso = CreateObject("Scripting.FileSystemObject"
set f = fso.GetFolder("\\server\folder")
set fc = f.Files
for each fl in fc
date = fl.DateLastModified
...
next
It appears that each time through the loop, it does network I/O to get
the DateLastModified. I would have thought that when you obtain the
folder's Files collection, that it would get the properties of each
file, not just an object representing each file. <sigh> I suppose when
you create the Files collection, it doesn't really mean that ANY data
has been obtained for each item in the collection. But in this case (and
may others), this is a terrible performance hit.
This object oriented stuff is sometimes a thing of beauty, but sometimes
the way it does things makes me wanna puke. I guess I want to be able to
tell it "get me the collection, and while you're at it, fill in
properties[property1, property2, ... propertyN] for each item in the
collection, 'cuz I'll be needing them in a second anyway."
--
jcf
on 2/9/2004 6:21 PM Dan King said the following:
> I saw something like this once that actually downloaded EVERY file EVERY
> time it checked, across our WAN.
> That may be what you are experiencing. You can use a "dir \\server\share"
> instead of mapping a drive. Works on 2000 and XP, not sure about older OSs.
>
> "John Ford" <zjcf@DawnAndJohn.net> wrote in message
> news:%23FvdX$07DHA.712@tk2msftngp13.phx.gbl...
>
>>I have a vbscript that looks through a folder structure for the most
>>recently updated file. I noticed that when I point it at a network
>>folder (\\server\folder) it does quite a bit more network I/O than I
>>would expect. No big deal when I'm at work, on our 100Mb ethernet, but
>>dialing in from home it becomes v e r y s l o w. When I go to a DOS
>>prompt and use "dir /s" to display the same folders, it's much quicker
>>(less network I/O).
>>
>>Is this just the way it is with the FileSystemObject? I'm ready to
>>rewrite my folder access to attach the desired folder as a drive, and
>>use the DOS DIR command to get the info I want. Excatly what the FSO
>>helps us avoid!
>>
>>--
>>jcf