1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim oFSO As Object
Dim oDrive As Object
Dim i As Integer
Dim driveNames As String() = { "\\aixcentre\c$\", "\\biollay\c$\" }
For i = 0 To driveNames.Length - 1
oFSO = CreateObject("Scripting.FileSystemObject")
oDrive = oFSO.GetDrive(driveNames(i))
If oDrive.freespace > 1 Then
If oDrive.IsReady Then
MsgBox("Free space: " & ConvertFreeSpace(oDrive.FreeSpace))
Else
MsgBox("Free space: <drive unavailable>")
End If
End If
Next
oDrive = Nothing
oFSO = Nothing |
Partager