ansitest/flist.sh

90 lines
1.8 KiB
Bash
Raw Normal View History

2022-02-28 11:55:35 -06:00
#!/bin/bash
2022-02-28 00:31:28 -06:00
2022-02-28 11:55:35 -06:00
# Go thru .tar.gz, .tar.bz2 in dir and list them to flist--file.txt
2022-02-28 11:54:11 -06:00
2022-02-28 00:31:28 -06:00
function process () {
2022-02-28 11:54:11 -06:00
#set -x
args="$*"
2022-02-28 00:31:28 -06:00
echo $args
# if doing rezip, renice bzip2
renice +1 `pidof bzip2` 2>/dev/null
# Preserve existing output
if [ -e "flist--$bn.txt" ]; then
2022-02-28 00:33:13 -06:00
echo "o Skipped $bn"
2022-02-28 11:54:11 -06:00
else
echo "Processing $bn"
if [ "$compr" = "" ]; then
time tar tvf $i > flist--$bn.txt
else
time $compr -cd $args |tar tvf - > flist--$bn.txt
fi
2022-02-28 00:31:28 -06:00
fi
}
#function processbz2 () {
# args=$*
# echo $args
# time tar tjvf $args > flist--$bn
#}
# If compare string not match any actual filename, move on
for i in *.tar.gz; do
[ "$i" == "*.tar.gz" ] && break;
bn=`basename $i .tar.gz`
compr=gzip
process $i
done
for i in *.tar1.gz; do
[ "$i" == "*.tar1.gz" ] && break;
bn=`basename $i .tar1.gz`
compr=gzip
process $i
done
for i in *.tgz; do
[ "$i" == "*.tgz" ] && break;
bn=`basename $i .tgz`
compr=gzip
process $i
done
for i in *.tar.bz2; do
[ "$i" == "*.tar.bz2" ] && break;
bn=`basename $i .tar.bz2`
compr=bzip2
process $i
done
for i in *.tar.lzop; do
[ "$i" == "*.tar.lzop" ] && break;
bn=`basename $i .tar.lzop`
compr=lzop
process $i
done
for i in *.tar1.lzop; do
[ "$i" == "*.tar1.lzop" ] && break;
bn=`basename $i .tar1.lzop`
compr=lzop
process $i
done
for i in *.tar; do
[ "$i" == "*.tar" ] && break;
bn=`basename $i .tar`
compr=""
2022-02-28 11:54:11 -06:00
process $i
# time tar tvf $i > flist--$bn.txt
2022-02-28 00:31:28 -06:00
done
for i in *.tar1; do
[ "$i" == "*.tar1" ] && break;
bn=`basename $i .tar1`
compr=""
2022-02-28 11:54:11 -06:00
process $i
# time tar tvf $i > flist--$bn.txt
2022-02-28 00:31:28 -06:00
done
2022-02-28 11:55:35 -06:00