List the files and directory in a drive

Hi,
Can u pls help me to write the code to get the list filenames and the directory names in a drive and the results should be printed in the textbox.it should work like "dir" in dos.
Thank u
rtananthanAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
iozturkConnect With a Mentor Commented:
There are controls drivelistbox, dirlistbox, filelistbox. Use them. If you want the results in a text box hide them and show selected values on text box.
0
 
AKbor75Commented:
see "dir" example in vb(a) help
0
 
supunrConnect With a Mentor Commented:
Private Sub DirListing_click()
    Dim DirectoryName As String
    Dim FileName As String
    Dim FolderName As String
   
    FolderName = "C:\"
    DirectoryName = Dir(FolderName, vbDirectory)
    Do While DirectoryName <> ""
        text1.text = text1.text & "[" & DirectoryName & "]" & vbcrlf
        DirectoryName = Dir
    Loop
    FileName = Dir(FolderName & "*.*")
    Do While FileName <> ""
        text1.text = text1.text &  FileName & vbcrlf
        FileName = Dir
    Loop
End Sub

' Good Luck!
0
 
CleanupPingCommented:
Hi rtananthan,
This old question (QID 20568472) needs to be finalized -- accept an answer, split points, or get a refund.  Please see http://www.cityofangels.com/Experts/Closing.htm for information and options.
0
 
GrahamSkanRetiredCommented:
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
Split points between iotturk and supunr
Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

GrahamSkan
0
All Courses

From novice to tech pro — start learning today.