mistral-io-datasets/datasets/decompress.sh

25 lines
616 B
Bash
Raw Normal View History

2020-08-18 09:16:49 +00:00
#!/bin/bash
2020-08-25 18:33:18 +00:00
comm="new" # decompress only new files
2020-08-18 09:16:49 +00:00
2020-08-25 18:33:18 +00:00
if [[ $# -eq 1 ]]; then
comm="$1"
fi
echo $comm
source_filenames=$( ls *.tar.xz )
for source_filename in ${source_filenames[@]}; do
target_filename=$(basename $source_filename)
target_filename="${target_filename%.*}" # remove .xz extension
target_filename=$(basename $target_filename)
target_filename="${target_filename%.*}" # remove .tar extension
if [ "$comm" == "all" ] || [ ! -f $target_filename ]; then
echo "Decompressing ${source_filename}"
tar -xJf "${source_filename}"
else
2020-08-26 10:54:27 +00:00
echo "Skipping decompression of ${source_filename}"
2020-08-25 18:33:18 +00:00
fi
2020-08-18 09:16:49 +00:00
done