CISA FotoGallery

Statistiche

Tot. visite contenuti : 895811
Home Articoli tecnici General WMI-File Function(Raccolta funzioni FSO)

WMI-File Function(Raccolta funzioni FSO)

SERIE DI FUNZIONI WMI ATTRAVERSO FSO

VERIFICA L'ESISTENZA DI UNA CARTELLA

Function ReportFolderStatus(fldr as string) as Boolean
    Dim
fso as object
    Set fso = CreateObject("Scripting.FileSystemObject")
    ReportFolderStatus= (fso.FolderExists(fldr))
End Function


CREA UNA SOTTOCARTELLA PASSANDO IL PERCORSO DELLA COLLECTION(FOLDER PARENT)

Sub AddNewFolder(path as string, folderName as string)
    Dim fso as object
    Dim f as object
    Dim fc as object
    Dim nf
    Set fso = CreateObject("Scripting.FileSystemObject")
    Set f = fso.GetFolder(path)
    Set fc = f.SubFolders
    If folderName <> "" Then
        Set
nf = fc.Add(folderName)
    Else
        Set
nf = fc.Add("New Folder")
    End If
End Sub


CREA UNA CARTELLA

Function CreateFolderDemo(FolderName as string)
    Dim fso as object
    Dim f as object
    Set fso = CreateObject("Scripting.FileSystemObject")
    Set f = fso.CreateFolder(FolderName)
    CreateFolderDemo = f.Path
End Function


CANCELLA UNA CARTELLA

Sub DeleteFolder(FolderPath As String)
    Dim fs As Object
    Set
fs = CreateObject("Scripting.FileSystemObject")
    fs.DeleteFolder FolderPath, True
    Set fs = Nothing
End Sub


COPIA UN'INTERA CARTELLA DA UNA POSIZIONE AD UN'ALTRA

FileSystemObject.CopyFolder "c:\mydocuments\letters\*", "c:\tempfolder\"

SPOSTA(MOVE) UN'INTERA CARTELLA DA UNA POSIZIONE AD UN'ALTRA

Sub MoveAFolder(Drivespec as string, DriveDest as string)
    Dim fso as object
    Set fso = CreateObject("Scripting.FileSystemObject")
    fso.MoveFolder Drivespec, DriveDest
End Sub


CANCELLA UN FILE

Sub DeleteAFile(filespec as string)
    Dim fso as object
    Set fso = CreateObject("Scripting.FileSystemObject")
    fso.DeleteFile(filespec)
End Sub


VERIFICA L'ESISTENZA DI UN FILE

Function ReportFileStatus(filespec as string) as Boolean
    Dim
fso as object
    Set fso = CreateObject("Scripting.FileSystemObject")
    ReportFileStatus= (fso.FileExists(filespec))
End Function



ESEGUE UN MOVE DI UN FILE DA UNA POSIZIONE AD UNA NUOVA

Sub MoveAFile(Drivespec as string, NewLocation as string)
    Dim fso as object
    Set fso = CreateObject("Scripting.FileSystemObject")
    fso.MoveFile Drivespec, NewLocation
End Sub


COPIA UNO O PIU' FILE DA UNA POSIZIONE AD UN'ALTRA

FileSystemObject.CopyFile "c:\mydocuments\letters\*.doc", "c:\tempfolder\"


Alessandro Baraldi