ich habe folgendes kleine Programm:
Code: Alles auswählen
EnableExplicit
UseLZMAPacker()
Structure _statistik
alleDateien.i
DateienOk.i
DateienError.i
EndStructure
Procedure BackupDateien(Path.s, hPack.i, Stammverzeichnisslaenge.i, SubDirectory.i, *Statistik._statistik)
Protected hDir.i = ExamineDirectory(#PB_Any, Path, "*.*")
If hDir
While NextDirectoryEntry(hDir)
If DirectoryEntryType(hDir) = #PB_DirectoryEntry_Directory And SubDirectory = #True
If DirectoryEntryName(hDir) <> "." And DirectoryEntryName(hDir) <> ".."
BackupDateien(Path + DirectoryEntryName(hDir) + "\", hPack, Stammverzeichnisslaenge, SubDirectory, *Statistik)
EndIf
ElseIf DirectoryEntryType(hDir) = #PB_DirectoryEntry_File
If hPack
Protected Quelle.s = Path + DirectoryEntryName(hDir)
Protected Ziel.s = Mid(Path + DirectoryEntryName(hDir), Stammverzeichnisslaenge)
*Statistik\alleDateien + 1
If AddPackFile(hPack, Quelle, Ziel)
Debug Quelle + " --> " + Ziel + " OK"
*Statistik\DateienOk + 1
Else
Debug Quelle + " --> " + Ziel + " ERROR"
*Statistik\DateienError + 1
EndIf
EndIf
EndIf
Wend
FinishDirectory(hDir)
EndIf
EndProcedure
Procedure.i ErstelleBackup(Backupdateiname.s, Startverzeichniss.s, Kompressionslevel.i, SubDirectory.i, *Statistik._statistik)
Protected hPack.i = CreatePack(#PB_Any, Backupdateiname, #PB_PackerPlugin_Lzma, Kompressionslevel)
If hPack
BackupDateien(StartVerzeichniss, hPack, Len(StartVerzeichniss) + 1, SubDirectory.i, *Statistik)
ClosePack(hPack)
EndIf
EndProcedure
Define Statistik._statistik
ErstelleBackup("B:\Backup.zip", "C:\Users\Topsoft\Documents\", 9, #True, Statistik)
Debug Str(Statistik\alleDateien) + " Dateien verarbeitet, " + Str(Statistik\DateienOk) + " Dateien gesichert, " + Str(Statistik\DateienError) + " wegen eines Fehlers nicht gesichert."
End
Hat jemand eine Idee ?
Gruß Topsoft