• Friday, February 28, 2014

    VB6: How to get all including hidden, system folders and files?

    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.

    Syed Masoom Rizvi

    Author & Editor

    Hi, This is Syed Masoom Rizvi, who is continue exploring the world of programming ,programming and programming... :)

    0 comments:

    Post a Comment