i have folder in that directory /var/qmail/Mail2DB/ from 000,001,002,003 onwards to 198. it means i have total 199 directories start from 000 thru 198. i have another directory /misc, i want to compress each folder /var/qmail/Mail2DB/000 and make a tar file like 000.tar, 0001.tar .... 198.tar. in /misc directory. can anyone suggest please. Between i want to use sleep for 10 second after each directory compress because i am using older version of linux so thats why, because after sometime it give me broken pipe error. i am waiting for suggestion please.
Hello Thanks for your suggestion, but i need to ignore 009 and 028 during this tar, how i can do that and i also want to give sleep of 10 second after every tar. is it possible i can start from 011 to 199, because this range thing will also resolve my issue alot.
That's funny because when you counted from 000 to 198 and concluded that was 199 things, I was agreeing with you! I just never thought to remove two random directories
I've never known UNIX (or Linux) to get bored doing stuff and deciding to pull the plug on a pipe, but OK, but I'm not that old.
New plan:
cd /var/qmail/Mail2DB
cat << ! > dont_tar_me.txt # modify as required
009
028
!
ls -d [0-9][0-9][0-9] | grep -vf dont_tar_me.txt | while read LINE; do
tar cf - "$LINE" | gzip > /misc/"$LINE".tar.gz
sleep 10
done