Skip to content

Instantly share code, notes, and snippets.

@stanwu
Created July 21, 2012 16:00
Show Gist options
  • Save stanwu/3156259 to your computer and use it in GitHub Desktop.
Save stanwu/3156259 to your computer and use it in GitHub Desktop.
check tgz files automatically
#!/bin/bash
mkdir -p log
for i in `ls *.tgz *.tar.gz`
do
echo "Check $i..."
tar tvzf $i > log/$i.log
if [ $? != 0 ]; then
mv $i $i.error
echo "$i error!"
fi
done
for i in `ls *.tar.bz2`
do
echo "Check $i..."
tar tvjf $i > log/$i.log
if [ $? != 0 ]; then
mv $i $i.error
echo "$i error!"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment