There is a very easy way of getting all folders and files from a folder, drive including hidden and system files/folders..
Step1: Create a new project
Step2: Add a command button
Step3: Add a listbox
Step4: Copy and paste this code in your project
Step1: Create a new project
Step2: Add a command button
Step3: Add a listbox
Step4: Copy and paste this code in your project
- Private Sub Command1_Click()
- Dim myfiles As String, mypath As String
- mypath = "C:\"
- myfiles = Dir(mypath, vbNormal + vbDirectory + vbHidden + vbSystem)
- Do While myfiles <> ""
- List1.addItem myfiles
- myfiles = Dir()
- Loop
- End Sub
Step5: Run and See Result.
Optional: You can use combination of vbNormal, vbHidden,vbSystem, vbReadOnly, vbArchive to get different result.
No comments:
Post a Comment