Skip to content

Instantly share code, notes, and snippets.

@tyrcho
Last active November 27, 2023 16:40
  • Star 6 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save tyrcho/479c18795d997c201e53 to your computer and use it in GitHub Desktop.
recursively unzip jar, war, ear files
#inspired by http://unix.stackexchange.com/questions/4367/extracting-nested-zip-files
while [ "`find . -type f -name '*.?ar' | wc -l`" -gt 0 ]; do 1 ↵
find . -type f -name "*.?ar" \
-exec mkdir -p '{}.dir' \; \
-exec echo "unzipping "{}" to "{}".dir" \; \
-exec unzip -o -d '{}.dir' -- '{}' \; \
-exec rm -- '{}' \;;
done
@santileortiz
Copy link

Hi, this seems very useful!, but when I tried it didn't work, isn't it missing a . in the find command being run inside the while?

@tyrcho
Copy link
Author

tyrcho commented Nov 7, 2021

yes you are right, I fixed it !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment