Created
January 2, 2018 22:10
-
-
Save AndrewBelt/2c8fbe4ca24231a147e348391fa747d6 to your computer and use it in GitHub Desktop.
Revisions
-
AndrewBelt created this gist
Jan 2, 2018 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,23 @@ #!/bin/bash OUT_NAME="$1" shift IN_NAMES="$@" TMP_DIR=$(mktemp -d) # Unzip each input ZIP for IN_NAME in $IN_NAMES; do unzip -n "$IN_NAME" -d "$TMP_DIR" done # ZIP all contents of uncompressed output into the temporary directory (cd "$TMP_DIR"; zip -r "$OUT_NAME" *) # Move output ZIP to final location mv "$TMP_DIR"/"$OUT_NAME" "$OUT_NAME" # Check contents of output ZIP unzip -l "$OUT_NAME" # Clean up all temporary files rm -r "$TMP_DIR"