VB6 - Testing if a directory is empty
folderExists and fileExists don't seem to accept wildcards. How can you check if a particular directory is empty?
Thanks
Andrew
Web Development
folderExists and fileExists don't seem to accept wildcards. How can you check if a particular directory is empty?
Thanks
Andrew
by tclere
If Dir("C:\Temp\*.*") = "" Then
'folder is empty
Else
'folder is not empty
End If
by ad
Only works if directory doesn't contain files - if directory contains just subdirectories then it will mis-report.
But - I didn't know about the 'Dir' command: lloking it up in the MSDN help does give some example code which does the job (andwhich can be modified to pick up directories and/or files.
by tmaclennan
by ad
by lo
Hi - #1 works fine.
You will also get a folder is empty if the directory path doesn't exist. Lo
by ad
by ad
This discussion is closed to new replies.
Sort by Trending