Results 1 to 5 of 5

Thread: Working with large amounts of files..

  1. #1

    Thread Starter
    Member
    Join Date
    Dec 2001
    Location
    Chicago, IL
    Posts
    49

    Working with large amounts of files..

    Hi all,

    I work with document imaging software which requires me to write a great deal of custom code. The one issue I have always had is working with a large numbers of files. Currently in a folder I have a total of 38,124 files. I have a need to write each of the filenames to a file. This is all easy enough stuff, but it is -very- slow and seems to have memory leaks etc. I am using the FSO to do this.

    Does anyone know of a fast way to access massive numbers of files?

    Many thanks,

    Darren Bridle

  2. #2
    Hyperactive Member
    Join Date
    Feb 2001
    Location
    Houston, TX
    Posts
    342
    If all you have to do is write the filenames to a file then you can do a DOS command for that.

    DIR >Files.txt

    If you have NT, XP, or 2K you can even put that in batch file and schedule it to run at a specified time (AT command)

  3. #3

    Thread Starter
    Member
    Join Date
    Dec 2001
    Location
    Chicago, IL
    Posts
    49
    Thats just one part of the software I am writing, so I really need to do it in the code.

  4. #4
    Hyperactive Member
    Join Date
    Feb 2001
    Location
    Houston, TX
    Posts
    342
    Here's an example. I don't know how fast it will run with the number of files you have but it's worth a try
    VB Code:
    1. Dim di As New System.IO.DirectoryInfo("C:\")
    2.         Dim fi As System.IO.FileInfo()
    3.  
    4.         fi = di.GetFiles()
    5.  
    6.         Dim j As Integer
    7.  
    8.         For j = 0 To fi.Length - 1
    9.             Console.WriteLine(fi(j).Name)
    10.         Next

  5. #5

    Thread Starter
    Member
    Join Date
    Dec 2001
    Location
    Chicago, IL
    Posts
    49
    Thanks everyone for your replies.

    Mag, your code seems to do the trick, its not super fast, but chugs through 38,000 files in about 10 seconds, which is fast enoguh for my purposes.

    - Darren

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width