Is there a way to check whether a file exists in a zip file?
I was unable to do so using the following code.
Var zipFile As FolderItem = SpecialFolder.Desktop.Child(“test.zip”).Child(“test.txt”)
If zipFile.Exists Then
MessageBox(“there was”)
Else
MessageBox(“There was none”)
End If
Someone correct me if I’m wrong but I believe you would need to create a temporary folder, extract the archive then examine the folderitems in that folder.
Alternatively, you could use the shell. On MacOS and Linux there’s zipinfo, on Windows you should be able to write a powershell script that will write a zip’s contents to stdout.
Do you use MBS Xojo Plugins?
You could use ArchiveReaderMBS or UnZipMBS classes to list files in the archive.
1 Like
Thank you.
I was able to solve a problem I’d been struggling with in no time.
Since it was added to the Folderitem Class, I thought I could treat the contents of a zip file like a regular file.
I’ll try the method you taught me.
Thank you.
I tried ArchiveReaderMBS and it was exactly what I needed.
Thank you.
ArchiveReaderMBS
1 Like