Get File Size problem

E

Ed

Is there any known issue with the use of "Scripting.FileSystemObject"?

Here's a snippet of my code to obtain the filesize of a file

Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.Getfile(strFileSpec)
lngFileSize = f.size
Set fso = Nothing

This used to work perfectly. But with the grown of files (now more than
50,000 files), this routine suddenly takes a long time to execute/hang.

Could someone shed some light into this matter?

We have Norton Antivirus installed. But with script blocking OFF.

Thank you.
 
B

Bob Barrows

Ed said:
Is there any known issue with the use of "Scripting.FileSystemObject"?

Here's a snippet of my code to obtain the filesize of a file

Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.Getfile(strFileSpec)
lngFileSize = f.size
Set fso = Nothing

This used to work perfectly. But with the grown of files (now more
than 50,000 files), this routine suddenly takes a long time to
execute/hang.

Could someone shed some light into this matter?

We have Norton Antivirus installed. But with script blocking OFF.

Thank you.

Have you tried this against a smaller folder to verify that the folder size
is the problem?

Norton may still be the problem even though script blocking is off. Try
disabling it completely to see what effect it has.

Bob Barrows
 
F

Foo Man Chew

Norton may still be the problem even though script blocking is off. Try
disabling it completely to see what effect it has.

Or uninstalling it. Norton is not enough for a server; get a firewall.
 
R

Roland Hall

: > Norton may still be the problem even though script blocking is off. Try
: > disabling it completely to see what effect it has.
:
: Or uninstalling it. Norton is not enough for a server; get a firewall.

Remove your NAV and get a firewall? Which firewall out there works as a
antivirus client for a server?

--
Roland

This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose.

-Technet Script Center-
http://www.microsoft.com/technet/treeview/default.asp?url=/technet/scriptcenter/default.asp
-MSDN Library-
http://msdn.microsoft.com/library/default.asp
 
F

Foo Man Chew

Remove your NAV and get a firewall? Which firewall out there works as a
antivirus client for a server?

What is anti-virus protection doing for a server? Unless you're using the
server as a client (e.g. opening e-mail and surfing the web from it), I'd be
more concerned about protecting the server from outside people, than
protecting it from my own stupidity.
 
B

Bob Barrows

Foo said:
What is anti-virus protection doing for a server? Unless you're
using the server as a client (e.g. opening e-mail and surfing the web
from it), I'd be more concerned about protecting the server from
outside people, than protecting it from my own stupidity.

Erm - opening e-mail and surfing the web are not the only way to catch a
virus. Viruses have been around long before there was the internet or email.
Case in point, there was at least one case where a virus was "included" on
the CD containing the installation files for a very well-known program from
a very well-known company.

Anyways, this discussion may be moot - it's not likely to be the OP's
problem ... oh! where did he go?

Bob Barrows
 
R

Roland Hall

:
: > Remove your NAV and get a firewall? Which firewall out there works as a
: > antivirus client for a server?
:
: What is anti-virus protection doing for a server?
Protecting it from virii/worms, etc.

: Unless you're using the
: server as a client (e.g. opening e-mail and surfing the web from it), I'd
be
: more concerned about protecting the server from outside people, than
: protecting it from my own stupidity.
I don't disagree but he didn't provide his network layout. He may already
have a firewall.

--
Roland

This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose.

-Technet Script Center-
http://www.microsoft.com/technet/treeview/default.asp?url=/technet/scriptcenter/default.asp
-MSDN Library-
http://msdn.microsoft.com/library/default.asp
 
E

Ed

Is there another way to get the filesize of any given file without using
FileSystemObject?
 
B

Bob Barrows

Ed said:
Is there another way to get the filesize of any given file without
using FileSystemObject?
Not without involving API calls, which are best done with a separate
component (a VB dll for example). According to this page,
http://home.att.net/~wshvbs/, it is possible to make API calls from script,
but I haven't tried it.

So have you verified that the folder size is the problem?

Bob Barrows
 
F

Foo Man Chew

So have you verified that the folder size is the problem?

FileSystemObject shouldn't have any folder size limitations. I just added a
network share to a SAN, hit an ASP page through windows auth, and it had no
problem iterating a folder on the SAN that has over 300,000 files, totalling
nearly 1 TB (with 2.5 TB free on that specific share).

Well, "no problem" should say "a little difficulty," because it wasn't as
quick as I'd expect. But it finished.

I would guess that (if it's not a Norton issue after all) the methodology
itself might be the problem. Rather than iterating through the entire
folder, treating each file individually and using GetFile to obtain a handle
to the file, why not do this:

set fso = CreateObject("Scripting.FileSystemObject")
set fold = fso.getfolder("C:\bigfolder\")
for each file in fold.files
response.write file.name & ", " & file.size & "<br>"
next

(You don't need a heavy file object if all you want to do is get the size.)

This is the code I used above. I did not attempt the exact code from the
o.p.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top