I know this is possible with a botched unTAR, although I can't recall the exact command.... but is it possible to "undo" a recent "unzip" command, in this case, using the mac terminal?
This is using /usr/bin/unzip
on 10.7, with UnZip 5.52.
Lets say I started with a folder structure like this....
admin$ pwd
/usr/local/src
admin$ ls
pots pans scrubbers.zip
admin$ unzip scrubbers.zip
admin$ ls
pots pans scrubbers.zip
zebraturd.doc README.md morestuffididntmeantoputhere.py cleanme.junkmail
surfraw.2.html scrubbers.explaination
how can i just "rezip" or parse the zip file in reverse?
there is a section in the zip file that sorta lists the files in the archive, although quite seriously mangled.. for example..
0L'†C 0L'†C !∏V≤B PK&Å‘:√@`¢îF3$ Lmacos/lib/libexiv2.2.1.0.dylib
without manually sifting through that list, is there a magic bullet for this?
You could try
or
and if you have spaces in filenames
check that the output is sensible and then change
echo
forrm
. In particular check that your zipfile isn't listed in the output. This isn't perfect as it will leave directories untouched but it may be easier than wading through it all by hand.Iain's answer threw a head-related error on my machine that I couldn't figure out... so I went ahead and wrote little BASH script that includes part of his solution, and that works quite nicely... just pass the original zip as an argument to this ununzip.sh script.. Comment the rm line to preview the "action".
I just manually delete the crud, whilst strenuously admonishing myself for not checking the zip file was sensibly formed (which they invariably aren't) with
unzip -l
first.Try this: