Results 1 to 4 of 4

Thread: Count Files in Folder. [RESOLVED]

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2005
    Posts
    537

    Resolved Count Files in Folder. [RESOLVED]

    How do I count the files in a folder?

    Thanks,
    Sir Loin
    Last edited by Sir Loin; Jun 29th, 2005 at 07:42 PM.

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Count Files in Folder.

    Here you go.

  3. #3
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: Count Files in Folder.

    The easy way is to use FileSystemObject (scripting library):
    VB Code:
    1. Private Sub Command1_Click()
    2. '===============================
    3. Dim fso As New FileSystemObject
    4. Dim fldr As Folder
    5.  
    6.     Set fldr = fso.GetFolder("c:\windows")
    7.     MsgBox "Total files in the folder: " & fldr.Files.Count
    8.  
    9. End Sub
    The better way is to use Windows API but this also means much more coding.

  4. #4

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2005
    Posts
    537

    Re: Count Files in Folder.

    Nice, thank you!

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