Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Get File Size problem

Reply
Thread Tools

Get File Size problem

 
 
Ed
Guest
Posts: n/a
 
      12-30-2003
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.


 
Reply With Quote
 
 
 
 
Bob Barrows
Guest
Posts: n/a
 
      12-30-2003
Ed wrote:
> 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

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"


 
Reply With Quote
 
 
 
 
Foo Man Chew
Guest
Posts: n/a
 
      12-31-2003
> 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.


 
Reply With Quote
 
Roland Hall
Guest
Posts: n/a
 
      12-31-2003
"Foo Man Chew" wrote
: > 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/tre...er/default.asp
-MSDN Library-
http://msdn.microsoft.com/library/default.asp


 
Reply With Quote
 
Foo Man Chew
Guest
Posts: n/a
 
      12-31-2003
> 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.


 
Reply With Quote
 
Bob Barrows
Guest
Posts: n/a
 
      12-31-2003
Foo Man Chew wrote:
>> 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.


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
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.


 
Reply With Quote
 
Roland Hall
Guest
Posts: n/a
 
      12-31-2003
"Foo Man Chew" wrote:
: > 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/tre...er/default.asp
-MSDN Library-
http://msdn.microsoft.com/library/default.asp



 
Reply With Quote
 
Ed
Guest
Posts: n/a
 
      01-02-2004
Is there another way to get the filesize of any given file without using
FileSystemObject?


"Bob Barrows" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> Ed wrote:
> > 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
>
> --
> Microsoft MVP - ASP/ASP.NET
> Please reply to the newsgroup. This email account is my spam trap so I
> don't check it very often. If you must reply off-line, then remove the
> "NO SPAM"
>
>



 
Reply With Quote
 
Bob Barrows
Guest
Posts: n/a
 
      01-02-2004
Ed wrote:
> 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

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"


 
Reply With Quote
 
Foo Man Chew
Guest
Posts: n/a
 
      01-03-2004
> 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.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: File Size - Big File Size Keith Thompson C Programming 6 10-03-2009 10:28 PM
Preferred Size, Minimum Size, Size Jason Cavett Java 5 05-25-2008 08:32 AM
Disconnect Between HD File Size & PS's File Size One4All Digital Photography 8 09-12-2007 03:02 AM
mega pixels, file size, image size, and print size - Adobe Evangelists Frank ess Digital Photography 0 11-14-2006 05:08 PM
compare file size with online file size tiewknvc9 Java 6 10-01-2006 09:30 AM



Advertisments