VMaxx.net
VMaxx techie board!
 
 FAQ   Search   Memberlist   Usergroups   Register 
 Profile   Log in to check your private messages   Log in 

VB 2008 Check number of files in directory

 
Post new topic   Reply to topic    VMaxx.net Forum Index -> Visual Basic
View previous topic :: View next topic  
Author Message
vmaxx
Site Admin


Joined: 27 Dec 2003
Posts: 132

PostPosted: Mon Jan 18, 2010 8:53 pm    Post subject: VB 2008 Check number of files in directory Reply with quote

Code:
        Dim s As String = "C:\FolderName"

        Dim d As New System.IO.DirectoryInfo(s)

        Dim intFolders, intFiles As Integer

        intFolders = d.GetDirectories.GetUpperBound(0) + 1

        intFiles = d.GetFiles.GetUpperBound(0) + 1

        MsgBox("This directory (" & s & ") has " & intFolders.ToString & _

        " folders and " & intFiles.ToString & " files.")

 

Replace "C:\FolderName" with the complete path to whatever folder you want to check.
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    VMaxx.net Forum Index -> Visual Basic All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2002 phpBB Group