CISA FotoGallery

Statistiche

Tot. visite contenuti : 928194
Home Articoli tecnici Moduli Funzioni su File

Funzioni su File

CODICE

Public Function MoveFile(StartPath As String, EndPath As String) As Boolean
    
'Sposta file
    
On Error GoTo error
    MoveFile = False
    FileCopy StartPath$, EndPath$
    Kill StartPath$
    MoveFile = True
    Exit Function
error:
    MsgBox Err.Description, vbExclamation, "Error"
End Function

Public Function
CopyFile(StartPath As String, EndPath As String) As Boolean
    
'Copia file
    
On Error GoTo error
    CopyFile = False
    FileCopy StartPath$, EndPath$
    CopyFile = True
    Exit Function
error:
    MsgBox Err.Description, vbExclamation, "Error"
End Function

Public Sub
DeleteFile(ByVal FilePath As String)
    'Cancella file
    
On Error GoTo error
    Kill FilePath$
    Exit Sub
error:
    MsgBox Err.Description, vbExclamation, "Error"
End Sub

Public Sub
ExecuteFile(FilePath As String)
    'Esegue file
    
On Error GoTo error
    Dim ret As Integer
    
ret = Shell("rundll32.exe url.dll,FileProtocolHandler " & (FilePath))
    Exit Sub
error:
    MsgBox Err.Description, vbExclamation, "Error"
End Sub

Public Function
DataCreazione(strPath) As Date
    
'Restituisce la Data di Creazione del File
    
On Error Resume Next
    
DataCreazione = FileDateTime(strPath)
End Function

Public Function
Dimensioni(strPath)
    'Restituisce la dimensione in Byte del File
    
On Error Resume Next
    
Dimensioni = fctRound(FileLen(strPath) / (1024)) & " KB"
End Function