UnZip files

Discuss about plugins that don't have a dedicated forum
Post Reply
xabierpayet
Posts: 267
Joined: Fri Feb 24, 2012 9:34 am

UnZip files

Post by xabierpayet »

how i can unzip a file with drawers and subdrawers? i´m attempting it, but doesn´t work here,
i can only unzip all the zipped files in the same drawer, can you post a short example for do it?
thanks
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: UnZip files

Post by airsoftsoftwair »

I don't have an example handy, but it's really not difficult. From the top of my head:

1) zip.OpenArchive()
2) Iterate over all entries in the ZIP archive (can be queried using #ZIPATTRNUMENTRIES)
3) Call zip.GetFileAttributes() on each entry to determine if entry is a file or a directory
4) If it's a directory, call MakeDirectory() to create it
5) If it's a file, call zip.ExtractFile() to unpack it
6) zip.CloseArchive()

That's pretty much about it. Shouldn't be difficult to implement. You don't even need recursion, just a simple for loop.
xabierpayet
Posts: 267
Joined: Fri Feb 24, 2012 9:34 am

Re: UnZip files

Post by xabierpayet »

perfect, working nice here
thanks
Post Reply