Get File Size problem

Discussion in 'ASP General' started by Ed, Dec 30, 2003.

  1. Ed

    Ed Guest

    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.
    Ed, Dec 30, 2003
    #1
    1. Advertising

  2. Ed

    Bob Barrows Guest

    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"
    Bob Barrows, Dec 30, 2003
    #2
    1. Advertising

  3. Ed

    Foo Man Chew Guest

    > 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.
    Foo Man Chew, Dec 31, 2003
    #3
  4. Ed

    Roland Hall Guest

    "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/treeview/default.asp?url=/technet/scriptcenter/default.asp
    -MSDN Library-
    http://msdn.microsoft.com/library/default.asp
    Roland Hall, Dec 31, 2003
    #4
  5. Ed

    Foo Man Chew Guest

    > 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.
    Foo Man Chew, Dec 31, 2003
    #5
  6. Ed

    Bob Barrows Guest

    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.
    Bob Barrows, Dec 31, 2003
    #6
  7. Ed

    Roland Hall Guest

    "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/treeview/default.asp?url=/technet/scriptcenter/default.asp
    -MSDN Library-
    http://msdn.microsoft.com/library/default.asp
    Roland Hall, Dec 31, 2003
    #7
  8. Ed

    Ed Guest

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


    "Bob Barrows" <> wrote in message
    news:%...
    > 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"
    >
    >
    Ed, Jan 2, 2004
    #8
  9. Ed

    Bob Barrows Guest

    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"
    Bob Barrows, Jan 2, 2004
    #9
  10. Ed

    Foo Man Chew Guest

    > 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.
    Foo Man Chew, Jan 3, 2004
    #10
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. tiewknvc9
    Replies:
    6
    Views:
    657
    Chris Uppal
    Oct 1, 2006
  2. Jason Cavett

    Preferred Size, Minimum Size, Size

    Jason Cavett, May 23, 2008, in forum: Java
    Replies:
    5
    Views:
    12,559
    Michael Jung
    May 25, 2008
  3. Keith Thompson

    Re: File Size - Big File Size

    Keith Thompson, Oct 1, 2009, in forum: C Programming
    Replies:
    6
    Views:
    288
    Phil Carmody
    Oct 3, 2009
  4. Michael Tsang

    Re: File Size - Big File Size

    Michael Tsang, Oct 4, 2009, in forum: C Programming
    Replies:
    2
    Views:
    316
    Keith Thompson
    Oct 4, 2009
  5. Nobody

    Re: File Size - Big File Size

    Nobody, Oct 5, 2009, in forum: C Programming
    Replies:
    10
    Views:
    2,022
    Flash Gordon
    Oct 10, 2009
Loading...

Share This Page