UnZip files

Discuss any general programming issues here
Post Reply
xabierpayet
Posts: 176
Joined: Fri Feb 24, 2012 9:34 am

UnZip files

Post by xabierpayet » Sun Sep 02, 2018 7:53 pm

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: 2962
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: UnZip files

Post by airsoftsoftwair » Mon Sep 03, 2018 10:25 pm

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: 176
Joined: Fri Feb 24, 2012 9:34 am

Re: UnZip files

Post by xabierpayet » Wed Sep 05, 2018 3:54 pm

perfect, working nice here
thanks

Post Reply