VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Use FileSystemObject to Get Info about a Drive

by Yuening Dai (30 Submissions)
Category: Miscellaneous
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Sat 9th January 1999
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Use FileSystemObject to Get Info about a Drive

Rate Use FileSystemObject to Get Info about a Drive



'Put a ListBox on your form and run the code.
'FileSystecmObject is very powerful in dealing with file system. 
'See VB help for more detailed info.
Private Sub cmdInfo_Click()
    '
    Dim fldr As Folder
    Dim fso As New FileSystemObject
    Dim drv As Drive
    '
    Set drv = fso.GetDrive(fso.GetDriveName("C:"))
    '
    With List1
        .AddItem "Available space: " & FormatNumber(drv.AvailableSpace / 1024, 0) & " BK"
        .AddItem "Drive letter: " & drv.DriveLetter
        .AddItem "Drive type: " & drv.DriveType
        .AddItem "Drive file system: " & drv.FileSystem
        .AddItem "Drive free space: " & FormatNumber(drv.FreeSpace / 1024, 0) & " BK"
        .AddItem "Drive is ready: " & drv.IsReady
        .AddItem "Drive path: " & drv.Path
        .AddItem "Root folder: " & drv.RootFolder
        .AddItem "Serial number: " & drv.SerialNumber
        .AddItem "Share name: " & drv.ShareName
        .AddItem "Total size: " & FormatNumber(drv.TotalSize / 1024, 0) & " BK"
        .AddItem "Volume  name : " & drv.VolumeName
    End With
    '
End Sub

Download this snippet    Add to My Saved Code

Use FileSystemObject to Get Info about a Drive Comments

No comments have been posted about Use FileSystemObject to Get Info about a Drive. Why not be the first to post a comment about Use FileSystemObject to Get Info about a Drive.

Post your comment

Subject:
Message:
0/1000 characters