Is there a simple way to unzip the contents of a specific .zip file, or does the process have to iterate through a file list?
I am serving .zip files from a server to a specific directory. I would like to initiate an unzip from a button for the entire archive to the same directory. The containing folder will be created automatically from the .zip extraction.
Once the process is complete, I want to delete the original .zip file, leaving the extracted content intact.
Any direction would be greatly appreciated, as always.
Thanks!
:Todd
How to unzip entire archive?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Re: How to unzip entire archive?
Hi Todd,
you will need to loop through the items in the archive!
This will get you started, check the docs for more info:
Of course you will need to check for error when unZIPPING but that's it basically,
hope that helps!
Best
Klaus
you will need to loop through the items in the archive!
This will get you started, check the docs for more info:
Code: Select all
...
## tArchive contains the path to the ZIP file
## tFolder = the TARGET folder for the files in the archive
## 1. Open archive for READ ONLY!
revZipOpenArchive tArchive,"read"
## 2. Put contents of archive into a list
put RevZipEnumerateItems(tArchive) into tList
## 3. Loop through all items in the ZIP archive and...
repeat for each line i in tList
## Just to be sure, I saw ean empty line in the ENUMERATION list.
## May not be neccessary, but who knows? ;-)
if i = empty then
next repeat
end if
## 4. ...save them into the target folder with the sameme filename as the original file
revZipExtractItemToFile tArchive,i,(tFolder & "/" & i)
end repeat
## 5. Close archive
revZipCloseArchive tArchive
## DONE! Now you can delete the ZIP file!
...
hope that helps!

Best
Klaus