Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

Hi,
i want to zip the files that generates automatically
every few minutes (files generated are in .arc
extension)....any body write a script for this...
thanks in advance

Answer Posted / narendrasairam

One way is to keep the code snippet in while loop with a
sleep time of 300 seconds (expecting 5 minutes time gap)


while true
do
FILE_EXIST_CHECK=`ls -l | grep ^- | wc -l`
if [ $FILE_EXIST_CHECK -ne 0 ];
then
if [ -f *.arc ];
then
ls *.arc > arc_files.lst
while read arc_filename
do
/usr/local/bin/gzip $arc_filename > /dev/null 2>&1
done < arc_files.lst
fi
else
echo " There are no .arc files existing...."
fi
sleep 300;
done

The other way is to schedule the job using crontab with a
time slice of minutes with out keeping in while true loop.

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can you write a script to portray how set –x works?

1004


Is powershell a bash?

1076


What is a program shell?

1047


Using set -A write a script to print the output of the ls command in 5 columns with two spaces between each column. Pretend that ls does not have multicolumn output.

2475


What does $0 mean in shell script?

1005


Determine the output of the following command: name=shubham && echo ‘my name is $name’.

985


How do you know which shell I am using?

1050


What is path variable bash?

1041


Write a command sequence to find all the files modified in less than 2 days and print the record count of each.

1515


Is shell scripting a language?

1040


How do I run a shell script on a mac?

1125


What is the meaning of $1 in shell script?

1118


What is shell company all about?

982


How can you get the value of pi till a 100 decimal places?

970


What is a shell environment?

996