CISA FotoGallery

Statistiche

Tot. visite contenuti : 928192
Home Articoli tecnici Moduli Funzioni su Folder

Funzioni su Folder

CODICE

Public Function MakeDir(DirPath As String) As Boolean
    
'Crea directory
    
On Error GoTo error
    MakeDir = False
    MkDir DirPath$
    MakeDir = True
Exit Function
error:
     MsgBox Err.Description, vbExclamation, "Error"
End Function

Public Sub
DeleteDir(DirPath As String)
    'Cancella directory
    
On Error GoTo error
    RmDir DirPath$
    Exit Sub
error:
    MsgBox Err.Description, vbExclamation, "Error"
End Sub

Public Sub
DelFilesInDir(DirPath As String, DelDir As Boolean)
    'Cancella tutti i Files di una Directory e..(opzionale) le Directory
    
On Error GoTo error
    Kill DirPath$ & "\*.*"
    Del_Dir:
    If DelDir = True Then
        RmDir
DirPath$
    End If
    Exit Sub
error:
    If Err.Number = 53 Then Resume Del_Dir
    MsgBox Err.Number & " " & Err.Description, vbExclamation, "Error"
End Sub