Could anybody provide an example pb how to unzip a zipped file?
I cannot figure out how to use pb UseZipPacker()??????
Regards,
SkyManager
[SOLVED] How to unzip a zipped file?
-
- Enthusiast
- Posts: 339
- Joined: Tue Jan 30, 2007 5:47 am
- Location: Hong Kong
[SOLVED] How to unzip a zipped file?
Last edited by SkyManager on Tue Jan 19, 2021 1:04 am, edited 1 time in total.
-
- Enthusiast
- Posts: 495
- Joined: Tue Oct 14, 2014 12:09 pm
Re: How to unzip a zipped file?
Here is an example with zip file
Purpose: To extract from a zip file all files with a PDF, JPEG or PNG extension.
Purpose: To extract from a zip file all files with a PDF, JPEG or PNG extension.
Code: Select all
UseZipPacker()
If OpenPack(0, fichier$,#PB_PackerPlugin_Zip)
If ExaminePack(0)
While NextPackEntry(0)
If PackEntrySize(0,#PB_Packer_UncompressedSize) > 0 And ( UCase(GetExtensionPart(PackEntryName(0)))= "PDF" Or UCase(GetExtensionPart(PackEntryName(0)))= "PNG" Or UCase(GetExtensionPart(PackEntryName(0))) = "JPEG" ) And ( PackEntryType(0) = #PB_Packer_File )
UncompressPackFile(0, GetTemporaryDirectory()+PackEntryName(0) , PackEntryName(0))
EndIf
Wend
EndIf
ClosePack(0)
Re: How to unzip a zipped file?
Here's the simplest example I have in my code library:
Code: Select all
UseZipPacker()
zipfilelocation$ = "C:\test\archive.zip"
destfolder$ = GetTemporaryDirectory() + "test_unzip\"
CreateDirectory(destfolder$ )
OpenPack(0, zipfilelocation$)
ExaminePack(0)
while NextPackEntry(0)
UncompressPackFile(0, destfolder$ + filename$)
wend
ClosePack(0)
-
- Enthusiast
- Posts: 339
- Joined: Tue Jan 30, 2007 5:47 am
- Location: Hong Kong
Re: How to unzip a zipped file?
thanks a lot