Full width home advertisement

Post Page Advertisement [Top]

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


  1. Private Sub Command1_Click()
  2. Dim myfiles As String, mypath As String
  3. mypath = "C:\"
  4. myfiles = Dir(mypath, vbNormal + vbDirectory + vbHidden + vbSystem)
  5. Do While myfiles <> ""
  6. List1.addItem myfiles
  7. myfiles = Dir()
  8. Loop
  9. 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

Bottom Ad [Post Page]

| Designed by Colorlib