Created
June 18, 2018 17:03
-
-
Save jamieparfet/d48c383c3b424664da2ccd2621e11c40 to your computer and use it in GitHub Desktop.
Extract all jar files within subdirectories into respective folders
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
BASE_PATH=/root/source-code/project/subdir | |
REMOVE_FROM_PATH=/root/source-code/project/ | |
OUTPUT_DIR=/root/testing/temp | |
for JAR_FILE in $(find "$BASE_PATH" -name "*.jar" -type f); do | |
# Show found .jar file | |
echo "File: $JAR_FILE" | |
# Perform unzip operation | |
unzip -qq $JAR_FILE -d $OUTPUT_DIR/$(echo ${JAR_FILE#$REMOVE_FROM_PATH} | sed 's/\//\__/g') | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment