From 4708cec3da5045e39a7a01f096cb9a5ba9c5206c Mon Sep 17 00:00:00 2001 From: Daniel Park Date: Tue, 12 Dec 2023 11:06:49 -0500 Subject: [PATCH] add multi-file version --- scripts/mcp_and_decompress.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100755 scripts/mcp_and_decompress.sh diff --git a/scripts/mcp_and_decompress.sh b/scripts/mcp_and_decompress.sh new file mode 100755 index 0000000..5e4d223 --- /dev/null +++ b/scripts/mcp_and_decompress.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +INFILES=${@:1:$#-1} +OUTDIR=${@:$#} + +for INFILE in $INFILES; do + if [[ $INFILE == *.gz ]]; then + OUTFNAME=$(basename $INFILE .gz) + pigz -dc $INFILE > "$OUTDIR/$OUTFNAME" + elif [[ $INFILE == *.zst ]]; then + OUTFNAME=$(basename $INFILE .zst) + zstd -d $INFILE -o "$OUTDIR/$OUTFNAME" + else + OUTFNAME=$(basename $INFILE) + cp $INFILE "$OUTDIR/$OUTFNAME" + fi +done