This works great and I'm completely happy with it. But, that first step of populating the list first with all of the entries, and THEN do the actual packing seems inefficient. If I could recursively walk through the folder AND pack the entries at the same time that would be awesome. But, I am having troubles with that for some reason. Because the procedure has to call itself throughout the operation when a new folder is found, I think I am mucking up the call. This is what I've got:
Code: Select all
EnableExplicit
UseZipPacker()
Procedure PackFolder(Folder.s, Pack.i)
If ExamineDirectory(0, Folder, "*.*")
While NextDirectoryEntry(0)
If DirectoryEntryType(0) = #PB_DirectoryEntry_File
AddPackFile(Pack, DirectoryEntryName(0), RemoveString(DirectoryEntryName(0), Folder))
Else
;AddPackDirectory(Pack, RemoveString(DirectoryEntryName(0), Folder))
AddPackDirectory(Pack, DirectoryEntryName(0))
PackFolder(DirectoryEntryName(0), Pack)
EndIf
Wend
FinishDirectory(0)
EndIf
EndProcedure
CompilerIf #PB_Compiler_IsMainFile
Define.i Pack
Pack = 0
CreatePack(Pack, "CampusData.zip", #PB_PackerPlugin_Zip, 5)
PackFolder("C:\CampusData\", Pack)
ClosePack(Pack)
CompilerEndIf
Has anyone had better luck with this?