I need to export Folders and Files in a .zip. I’m looking to MBS Xojo Compression Plugin.
I don’t found what I’m looking for.
For now I have a exportFolder (as FolderItem) in the tmp special directory. I can ask my user a destination filename with saves message dialog so I have zip Destination (as FolderItem)
How can I easily put all my folders / subfolder and files in this export.zip file?
// Create temporary Export Folder
Var exportFolder As FolderItem = SpecialFolder.Temporary.Child("export")
System.DebugLog(exportFolder.URLPath)
// Create Export Folder
exportFolder.CreateFolder
// Get Documents to export
Var documents() As DataModel.DocumentTable
// fill documents list
// ....
Try
// Export Files List
For Each d As DataModel.DocumentTable In documents
// Origin File
Var oFolderItem As FolderItem = mDBManager.DocumentTableReadBlob(d.ID)
If oFolderItem <> Nil Then
// Destination
Var dFolderItem As FolderItem = d.destinationFolderItem(exportFolder)
// Copy file
oFolderItem.CopyTo(dFolderItem)
End If
Next
Catch error As DatabaseException
// Something wrong
MessageBox(error.Message)
End Try
// Ask for Export zip file
Var zipDestination As FolderItem = FolderItem.ShowSaveFileDialog(".zip", "export.zip")
System.DebugLog(zipDestination.URLPath)
// TODO Zip Tmp folder in Export file
The console log is
17:57:35 : file:///var/folders/fd/1qt6d6p963n6fpxp0k7ddmtw0000gn/T/export/
17:57:39 : file:///Users/seb/Documents/export.zip