|
-
Nov 25th, 1999, 03:12 AM
#1
Thread Starter
New Member
How would I get the number of files in a directory?
Like, I have 29 .htm files and 15 .txt files in a directory, I want to return the number of .htm files in a directory
Can anyone help me?
-
Nov 25th, 1999, 08:45 AM
#2
Addicted Member
Hi vaer,
Put a FileListBox control with the name of File1 on your form and to check, just execute the script below.
With Me.File1
.Path = "c:\windows\system\"
.Pattern = "*.htm"
MsgBox (.ListCount)
End With
Does it help ?
Regards
-
Nov 25th, 1999, 09:06 AM
#3
Thread Starter
New Member
Thats the closest ive gotten so far, to what I need to do, Thanks a lot
-
Nov 25th, 1999, 09:15 AM
#4
Thread Starter
New Member
I would like to be able to do it without a filelistbox though.... if thats possible...
-
Nov 25th, 1999, 12:28 PM
#5
Use the Dir Function and Count the Files Returned, eg.
Code:
Private Sub Command1_Click()
MsgBox NumFiles("C:\*.txt")
End Sub
Private Function NumFiles(ByVal sFileType As String) As Integer
Dim iCount As Integer
Dim sDir As String
sDir = Dir(sFileType, vbHidden + vbReadOnly + vbSystem + vbNormal)
While Len(sDir)
iCount = iCount + 1
sDir = Dir
Wend
NumFiles = iCount
End Function
------------------
Aaron Young
Analyst Programmer
[email protected]
[email protected]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|