1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
| Function GETINFO_PARTAGE(FS1, varwhere)
On Error Resume Next
'création du chemin du partage PathShare
Dim PathShare : PathShare = "\\" & FS1 & "\Partage"
'check de la dispo du lecteur
If fso.driveExists("I:") Then
Net.RemoveNetworkDrive "I:", True, True
Net.MapNetworkDrive "I:", PathShare, , User, Password
Else
Net.MapNetworkDrive "I:", PathShare, , User, Password
End If
'Attrappe le disque I:
Dim Disque : Set Disque = fso.GetDrive("I:")
'récupère l'occupation et le disponnible
Dim Occup : Occup = FormatNumber(((Disque.TotalSize - Disque.FreeSpace)/1024^3), 3)
Dim Dispo : Dispo = FormatNumber((Disque.FreeSpace/1024^3), 3)
Dim colDossiers, Dossier, outinfo
If err.number <> 0 then
GETINFO_PARTAGE = PathShare & ";Non Disponible"
On Error Goto 0
Exit Function
End If
outinfo = PathShare & ";" & Occup & ";" & Dispo & vbCrlf
Set colDossiers = fso.getFolder(PathShare).SubFolders
For each Dossier in colDossiers
on error resume next
outinfo = outinfo & varwhere & ";" & UCase(dossier.path) & ";" & FormatNumber((dossier.size/1024^3), 3) & vbCrlf
If Err.Number <> 0 Then
outinfo = outinfo & varwhere & ";" & UCase(dossier.path) & ";" & Err.Description & vbCrlf
On Error Goto 0
End If
Next
Net.RemoveNetworkDrive "I:", True, True
GETINFO_PARTAGE = Left(outinfo, Len(outinfo) -1)
End Function 'GETINFO_PARTAGE |
Partager