How to count huge amount of files in folder

Discussion in 'ASP .Net' started by MichiMichi, Mar 14, 2007.

  1. MichiMichi

    MichiMichi Guest

    My asp.net application has a directory which is filled up with over 17
    files (email) a second. After a while this sums up into a huge amount
    of files.

    I usually count files with the GETFILES method. This works perfectly
    of there are only a few hundert files in the folder

    *********
    .....
    Dim files() As String
    files = IO.Directory.GetFiles(mycontext.Server.MapPath(".\myFolder
    \"), "*")
    .....
    *********

    When my application goes offline than it can happen that over 200,000
    files are waiting in the folder to be processed.
    The method GETFILES does not work anymore. There are just to many
    files. I can wait for hours any nothing happens.

    Is there a better method to count files inside a folder for ASP.NET
    2.0?
     
    MichiMichi, Mar 14, 2007
    #1
    1. Advertising

  2. MichiMichi

    Patrice Guest

    You could try win32. If I remember the problem is that the collection
    returns data once all files are processed. Win32 allows to return each name
    in turn plus it could be quicker if you are not even interested in storing
    details...

    Also another option would be to closely look if you really need this number
    (for example you could perhaps queue this to a file or a DB or in different
    directories to avoid overblotting a single directory, or you could number
    your files and using the last processed and last created could give a usable
    value depdning what you are doing with this number etc...).


    "MichiMichi" <> a écrit dans le message de news:
    ...
    > My asp.net application has a directory which is filled up with over 17
    > files (email) a second. After a while this sums up into a huge amount
    > of files.
    >
    > I usually count files with the GETFILES method. This works perfectly
    > of there are only a few hundert files in the folder
    >
    > *********
    > ....
    > Dim files() As String
    > files = IO.Directory.GetFiles(mycontext.Server.MapPath(".\myFolder
    > \"), "*")
    > ....
    > *********
    >
    > When my application goes offline than it can happen that over 200,000
    > files are waiting in the folder to be processed.
    > The method GETFILES does not work anymore. There are just to many
    > files. I can wait for hours any nothing happens.
    >
    > Is there a better method to count files inside a folder for ASP.NET
    > 2.0?
    >
     
    Patrice, Mar 14, 2007
    #2
    1. Advertising

  3. "MichiMichi" <> wrote in message
    news:...
    > My asp.net application has a directory which is filled up with over 17
    > files (email) a second. After a while this sums up into a huge amount
    > of files.
    >
    > I usually count files with the GETFILES method. This works perfectly
    > of there are only a few hundert files in the folder
    >
    > *********
    > ....
    > Dim files() As String
    > files = IO.Directory.GetFiles(mycontext.Server.MapPath(".\myFolder
    > \"), "*")
    > ....
    > *********
    >
    > When my application goes offline than it can happen that over 200,000
    > files are waiting in the folder to be processed.
    > The method GETFILES does not work anymore. There are just to many
    > files. I can wait for hours any nothing happens.
    >
    > Is there a better method to count files inside a folder for ASP.NET
    > 2.0?
    >


    Take a look this article
    http://msdn.microsoft.com/msdnmag/issues/05/12/NETMatters/
     
    Alexey Smirnov, Mar 14, 2007
    #3
    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. =?Utf-8?B?RGFuaWVsIFdhbHplbmJhY2g=?=

    Trouble with huge amount of State Server Sessions Timed out

    =?Utf-8?B?RGFuaWVsIFdhbHplbmJhY2g=?=, Jul 20, 2005, in forum: ASP .Net
    Replies:
    7
    Views:
    2,688
    Jerald Carter
    Sep 28, 2006
  2. Gabriel Genellina

    Efficient format for huge amount of data

    Gabriel Genellina, Jan 20, 2004, in forum: Java
    Replies:
    21
    Views:
    840
    Alan Chen
    Jan 23, 2004
  3. Jan Fischer
    Replies:
    10
    Views:
    173
    Robert Klemme
    Oct 9, 2008
  4. Replies:
    9
    Views:
    134
  5. Ishmael
    Replies:
    2
    Views:
    119
    Ted Zlatanov
    Mar 5, 2009
Loading...

Share This Page