topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Saturday December 14, 2024, 5:10 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: DONE: Req: (Autohotkey script ): auto unzip zip files in a folder recursively ?  (Read 46805 times)

jity2

  • Charter Member
  • Joined in 2006
  • ***
  • default avatar
  • Posts: 126
    • View Profile
    • Donate to Member
Hello,

I would like to unzip any zip files contained in a folder, and its subfolders, and its subfolders and....
I was using the freeware unziplify but it does not seem to work well anymore on my computers (xp or vista). It falsely says that my zip file is corrupt even if atfer some test Winrar and 7-zip software say everything is fine.

I am using an Autohotkey script which does the zipping with Winrar command line software perfectly but could anyone help me do the unzipping ?
Here is a 2006 old thread which explains how I still do the zipping :
https://www.donation...dex.php?topic=4657.0

I guess it may be possible to use an Autohotkey script using the Winrar command line software (so like that I would be aware of unzipping errors) but I am open to any other suggestions.

Many thanks in advance ;)
« Last Edit: January 19, 2010, 01:33 PM by jity2 »

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,287
    • View Profile
    • Donate to Member
This would be a piece of cake to write in AHK using unrar.exe.  I envision this having two fields and button:

1) Source folder.
2) Destination folder.
3) Button to initiate the unzipping.

Also, one would have to use the option to unzip each archive to its own folder.  Would you agree?


jity2

  • Charter Member
  • Joined in 2006
  • ***
  • default avatar
  • Posts: 126
    • View Profile
    • Donate to Member
Hello,

I like your suggestion skwire. ;)

Thanks in advance ;)

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,287
    • View Profile
    • Donate to Member
So, are you going to give it a shot or would you like me to write it?

jity2

  • Charter Member
  • Joined in 2006
  • ***
  • default avatar
  • Posts: 126
    • View Profile
    • Donate to Member
Hello skwire,
 I would much prefer if you could do it for me as I have no clue at how to do that !
Thanks in advance ;)

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,287
    • View Profile
    • Donate to Member
Give this a try (source/binary included): Download

2010-01-19_171744.pngDONE: Req: (Autohotkey script ): auto unzip zip files in a folder recursively ?

1) Unpack that to a folder and run RecurUnZip.exe (or RecurUnZip.ahk if you have AutoHotkey installed).
2) Select a source and destination folder.
3) Click the "Unpack files" button.

Let me know how it works for you.  Thanks.

jity2

  • Charter Member
  • Joined in 2006
  • ***
  • default avatar
  • Posts: 126
    • View Profile
    • Donate to Member
Good morning skwire,

Many thanks for your fast answers and help. ;)

I did some tests under Vista. Alas they were not all successful, I keep getting the following error : "The following files had problems extracting:".

By luck could you also add such options :
- if unzip successful, delete the zip file
- if errors, it does not display the list of the kind of errors the program has met (example: in zip file try01.zip, the files glop001.html and gyeop.htm are in error)!
- I don't know if this could help but I had the following options set up in unziplify (see image )

I am not sure, but I assume that if the last folder (which contains a zip file) has a space in its name, it is causing an error (it also could be some accents "e" instead of "é" or some several "." or other special ";"... in a file name inside a zip file).
Maybe some bugs might be due to the file IZARCE.exe ? I know that previously there were some errors with other zip command line programs (ex: Powerarchiver see https://www.donation...dex.php?topic=4657.0), but not in Winrar command line...

Example: I used spinzip (great program !) to create 10Mb zip files (with compression = 5) in folder "1 OT1", it worked without errors and created 17 zip files. ;)
Then I used "RecurUnZip.ahk" and asked to unpack files in the same folder and got errors (see image "iz" below. All the subfolders have been created but they are empty)

I am doing to test also in xp and let you know if I have the same problems.
Many thanks in advance ;)
« Last Edit: January 20, 2010, 02:38 AM by jity2 »

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,287
    • View Profile
    • Donate to Member
I did some tests under Vista. Alas they were not all successful, I keep getting the following error : "The following files had problems extracting:".

Hmmm...was it not listing the zip files it had problems with?  Did it unzip anything successfully?

Example: I used spinzip (great program !) to create 10Mb zip files (with compression = 5) in folder "1 OT1", it worked without errors and created 17 zip files. ;)
Then I used "RecurUnZip.ahk" and asked to unpack files in the same folder and got errors (see image "iz" below. All the subfolders have been created but they are empty)

That is odd.  I just did the same test with SpinZip and RecurUnZip...and both worked perfectly.

jity2

  • Charter Member
  • Joined in 2006
  • ***
  • default avatar
  • Posts: 126
    • View Profile
    • Donate to Member
Hello skwire,

Thank you for your fast answer. I appreciated. ;)

Here are more tests under Vista (C:\ is formated in NTFS). I hope this help. ;)


Example 01:
If I use 7-zip.exe

Folder to be zipped:
C:\Users\jity1234\Desktop\1234567\0 1234567 dec09\1 OT1\
result
C:\Users\jity1234\Desktop\1234567\0 1234567 dec09\1 OT1\1 OT1.zip

zipping is ok and has no error.

if I unzip 1 OT1.zip in the folder
C:\Users\jity1234\Desktop\1234567\0 1234567 dec09\1 OT1\super01\
Result
C:\Users\jity1234\Desktop\1234567\0 1234567 dec09\1 OT1\1 OT1\then_the_files_unzipped_here

unzipping is ok and has no error.


Example 02:
If I use SpinZip for zipping = no errors.
But with RecurUnZip, errors displayed



Example 03:
Same than with example 01, but with winrar zipping in .zip
No error in zipping
but, errors in unzipping :
---
!   C:\Users\jity1234\Desktop\1234567\0 1234567 dec09\1 OT1\1 OT1.zip: Cannot create 1 OT1\efl_infoEF38706-des-le-premier-1245-de-1234567-les-1234-123456-12345678es-subiront-12-1-de-12345678ents-en-2010_20091214_144224_files\1931275723x50TopTop2Top3x01Middle3Middle4Middle5LeftLeft1Bott.js
    Total path and file name length must not exceed 260 characters
!   Le chemin d'accès spécifié est introuvable. [means : The specified path was not found.]

...etc...
---
It seems normal as the file has 285 characters.



Example 04:
so I have some problems in my original not_zipped folder.
I have moved it to C:\essai\1 OT1\ with the freeware Supercopier2 ( http://supercopier.s...q=node/type/download can detect errors in filenames apparently). The size in octet and number of folders and files are the same in both unzipped 1 OT1 folders.

If i use Winrar
Folder to be zipped (extract to : .zip everything else are the default options):
C:\essai\1 OT1\
result
C:\essai\1 OT1\1 OT1.zip
ok with no errors

if I copy and unzip 1 OT1.zip in the folder
C:\essa2\1 OT1.zip
Result
C:\essa2\1 OT1\1 OT1\then_there_all_the_files

Please notice the second same folder.

The size in octets and the files number is the same, but there is one more folder (the second "1 OT1").
If I check the properties directly inside C:\essa2\1 OT1\, the properties are exactly the same.
So the work has been done properly. ;)

But when I delete manually the unzipped folder (1 OT1), I have a Windows error message:
"It is not possible to put some elements which have a too long name in the bin, do you want to delete the folder permanently ?"
I choose yes and I see the green bar becoming red during 2 seconds then it finish the job in green properly.
I don't think that this problem is really important !
If I test the folder C:\essai\1 OT1\ with LongFile.exe (freeware http://www.dcsoft.co...ts/longff/longff.htm )
I have diplayed the files that have more than 100 characters (please see the image :

 size ScreenShot00981.png).

Even if I add the 15 characters of "C:\essai\1 OT1\" , I still have to understand why I have the windows long file name error. Anyway, thanks in advance if anyone knows why. ;)



Example 05:
same beginning than example 1 but I copy and unzip the zipped file in the folder C:\essa2\  with winrar
I have the same ok result than in example 4.




So, I am a little confused right now. Maybe before zipping I should process some kind of test ?? :
check if files inside folders have more than 100 (better than 260 characters limit as folder is not included in the test I assume), if yes rename automatically to 50 characters ?
As I save a lot of html pages, the renaming should rename both the htm (or html) file and its related folder, so I could be able to open such kind of files properly in the future. ;)
Then, finally doing the zipping. ;)

Many thanks in advance ;)

« Last Edit: January 20, 2010, 05:16 AM by jity2 »

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,287
    • View Profile
    • Donate to Member
I appreciate all of the testing you've done.  Based off of what I see, would you like me to switch to the 7-zip.exe?  It seems that one gave you the fewest problems.

jity2

  • Charter Member
  • Joined in 2006
  • ***
  • default avatar
  • Posts: 126
    • View Profile
    • Donate to Member
Hello skwire,

My pleasure. ;) Thank you to you! ;)
I agree with your suggestion as with example 1 (7-zip) the octets size are the same in both unzipped folders located inside the long path.

Thanks in advance ;)

jity2

  • Charter Member
  • Joined in 2006
  • ***
  • default avatar
  • Posts: 126
    • View Profile
    • Donate to Member
more details for example 2:

Example 02:
If I use SpinZip for zipping = no errors.
By luck, could you make the default compression number being 5 (= I assume it is normal compression) ? Or may I be able to change that in the .ini file ?


But with RecurUnZip, errors displayed
And the folder created is void (unzipping was really too fast!). I assume it is because RecurUnZip uses IZARCE internally.
Moreover I am just noticed that this time 3 empty folders (0,1,2) were created in C:\Users\jity\Desktop\RecurUnZip  !

Thanks in advance ;)

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,287
    • View Profile
    • Donate to Member
Here's the 7-zip version: Download

Let me know if that works out better for you.

jity2

  • Charter Member
  • Joined in 2006
  • ***
  • default avatar
  • Posts: 126
    • View Profile
    • Donate to Member
Hello again skwire !;)

Thank you very much for your great help. ;)

If I do : example 1, it is working fine. Same octet size. wow! ;)

(For information: If I do first the zipping with  Spinzip (izarc.exe), the unzipped size is slighlty different than the original (1Mo / 177Mo about 35 files missing))


note: see image for current path


I have to do more tests with 2 other problematic folders and let you know how it turns out. And test on xp.

Thanks again ;)

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,287
    • View Profile
    • Donate to Member
Doh, I re-upped the archive without my test paths in it.  Je suis vraiment désolé.

jity2

  • Charter Member
  • Joined in 2006
  • ***
  • default avatar
  • Posts: 126
    • View Profile
    • Donate to Member
No problem skwire ;)
Thank you ;)

I did more tests with 2 other problematic folders on vista and it worked fine ;)

I did other tests on xp (will do them on vista later) and RecurUnZip is working fine again. ;)

I have just found one bug (I don't think it is xp related!) :
In the folder : H:\1_123_u\2009\Mebo07-10_2009  I have two subfolders (and nothing else) :
H:\1_123_u\2009\Mebo07-10_2009\Mebo09_2009
 and
H:\1_123_u\2009\Mebo07-10_2009\Mebo10_2009

Both these subfolders contain one or more zip file(s). example :
H:\1_123_u\2009\Mebo07-10_2009\Mebo09_2009\exa01.zip
...etc

When I use RecurUnZip and give him the same folder : H:\1_123_u\2009\Mebo07-10_2009
alas it unzip the zip file here:
H:\1_123_u\2009\Mebo07-10_2009\
but not here:
H:\1_123_u\2009\Mebo07-10_2009\Mebo09_2009\exa01\
...

Thanks in advance ;)

jity2

  • Charter Member
  • Joined in 2006
  • ***
  • default avatar
  • Posts: 126
    • View Profile
    • Donate to Member
Hello,

After much more tests all this morning, here is what I have found :

Vista
If I use 7-zip for zipping and the last RecurUnZip version (using 7-zip fo runzipping), it works great (same size octets & same files numbers). ;)
The only small problem being that there may be some problems when later one wants to delete files [path+filenames] longer than 260 characters.
Solutions (*): go one parent folder before and rename the folder with a shorter name and it should delete the folder and the longname file inside.
( (**) this seems normal as since 2007: "7-Zip now supports file pathnames longer than 260 characters."
http://209.85.229.13...;ct=clnk&client=)

Xp
If I use 7-zip for zipping (done under vista), and unzipping in XP the last RecurUnZip version (using 7-zip fo runzipping),it works ok.
But is it not working fine for [path+filenames] that have more than 260 characters (i.e. the 3 folders were I had problems originally with unziplify and winrar). The files seems properly unzipped but are not exactly of the same octet size and not really accessible in the Xp explorer.
The solution I have found is to:

Use this freeware (I have tried many others but they failed under vista!):
Pathscanner (http://www.parhelia-...ner/PathScanner.aspx) and list files that are longer than 260 characters.

Tip: Pease note that it is better to know in advance where the zip file will be unzipped and how long that path will be!

Personal example :
I zip this folder (folder path = 56 characters)
C:\Users\jity1234\Desktop\1234567\0 1234567 dec09\1 OT1\
which gives this file :
C:\Users\jity1234\Desktop\1234567\0 1234567 dec09\1 OT1\1 OT1.zip


But when I unzip the zip file I use into another place: ( folder path = 32 characters)
H:\archive\2009\0 1234567 dec09\1 OT1.zip
it gives :
H:\archive\2009\0 1234567 dec09\1 OT1\[unzipped_files_here]  ( folder path = 38 characters)


So there is a difference of 18 (56-38) characters less in my destination folder of the unzipped file than the original folder.
I have to keep in mind this when I check the path characters number before zipping the original folder.
In my case : 278 characters (260 Vista limit + 18 of difference) limit should be fine. ;)
So I rename and/or save text copy of files (usually html files in my case) in my original folder before zipping.
 

I hope this helps and thanks in advance to skwire. ;)



(*) other possibilities:
- http://ccollomb.free.fr/unlocker/
- rigth click on the folder, uncheck "read only". Then, click on "advanced" and check "ready to be archived" and "compress what is inside" (sorry rough translation from french!)

(**) more infos on this 260 characters limit
http://www.windowsre...itations-in-windows/
http://stackoverflow...in-ntfs-xp-and-vista
http://stackoverflow...-than-260-characters
http://msdn.microsof...5247%28VS.85%29.aspx
http://www.codinghor...archives/000729.html

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,287
    • View Profile
    • Donate to Member
So, jity2, can we call this Coding Snack completed?

jity2

  • Charter Member
  • Joined in 2006
  • ***
  • default avatar
  • Posts: 126
    • View Profile
    • Donate to Member
Hello skwire,

So, jity2, can we call this Coding Snack completed?

Short answer: yes ! ;)


Long answer (in case it may help other persons) :
With "path scanner" I use the 273 limit (= 278 - (260-255)) as vista limit is 260 and xp limit is 255 !



*
Unziplify found a new kind of bug ("the file seems to be corrupt") as there was 4 htm files with this size:
.htm 1ko
related folder 1Mo

When I checked the .htm in firefox, not everything has been saved properly (firefox loaded the missing info from the internet).

note: all the 4 htm files (and related folders) had names starting with "www." ! May be a bug in Firefox ? I try to repeat this firefox but this time everything was saved properly!  :huh:


*
Another error found ("the file seems to be corrupt") by unziplify :
Inside the related folder on one html file, there was a tiny file that vista could not have access to.
Solution: save the text and deleted .htm and related folder.




*
I have use the freeware "CSDiff 5" (http://download.cnet...2248_4-10009023.html) so I could find the what was the missing file in the case just above.
To my surprise, I have found a real (small) bug in unziplify :
If there is
" ' "
 or
" << "
or
" " "
 (spaces not included) in the [.htm + related folder] name unziplify transform into strange characters.
note: the folder size in octet and file number is exactly the same !  :huh:
Hopefully I can still load the html file in firefox and read the text correctly. The only problem being that images contained inside the related folder are not loaded in firefox but can be openned manually in the explorer. ;)


Many thanks again for your help ;)

nkormanik

  • Participant
  • Joined in 2010
  • *
  • Posts: 554
    • View Profile
    • Donate to Member
Slightly different request, Skwire....  Instead of asking for a destination folder, and creating a different directory structure.

I would prefer that any archive simply be replaced with an unarchived folder, or the contents of the archive.  In place, in present directory structure.

This is what the old program unziplify did (no longer available, and apparently stopped working due to some Windows system upgrade).

What do you think?

Thanks!


jity2

  • Charter Member
  • Joined in 2006
  • ***
  • default avatar
  • Posts: 126
    • View Profile
    • Donate to Member
Hi nkormanik,

I still use unziplify in windows 8.1 64bits. And it still works fine for me. Apparently you can find it here now :
http://unziplify.en.uptodown.com/

See ya ;)

jity2

  • Charter Member
  • Joined in 2006
  • ***
  • default avatar
  • Posts: 126
    • View Profile
    • Donate to Member
In case anyone is interested here is a follow up for rar files :
https://www.donation...ex.php?topic=40881.0
« Last Edit: May 09, 2015, 09:03 AM by jity2 »

gregory2015

  • Participant
  • Joined in 2015
  • *
  • default avatar
  • Posts: 1
    • View Profile
    • Donate to Member
I am using Long Path Tool software for such errors, and it works like charm. :Thmbsup:

tomos

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 11,964
    • View Profile
    • Donate to Member
Instead of asking for a destination folder, and creating a different directory structure.
I would prefer that any archive simply be replaced with an unarchived folder, or the contents of the archive.  In place, in present directory structure.
This is what the old program unziplify did (no longer available, and apparently stopped working due to some Windows system upgrade).
I still use unziplify in windows 8.1 64bits. And it still works fine for me. Apparently you can find it here now :
http://unziplify.en.uptodown.com/
Unziplify seems to work well in Windows 10 with one caveat --

SETTINGS:
  • delete archives after unzipping successfully [to same location i.e. no new folders created]
  • prompt to overwrite

With #2, unfortunately it gives no file information if the file already exists.
If I then select No (do not overwrite) for #2 there -- the zip file is still deleted.
Tom