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 / srinivas

Assuming the *.arc files are getting generated under every
5 minutes..

Create script.sh and cut paste the following contents
--------------------------
while true
do
for i in `ls *.arc` ;
do
ls *.arc 2> /dev/null
if [ $? -eq 0 ]
then
gzip $i
else
echo "No files to be zipped at this moment...Exiting"
exit 1
done
sleep 300
done
--------------------------

Hope this helps

-- Srini

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do I set bash as default shell mac?

561


Why are shell scripts used?

628


Write the syntax for "if" conditionals in linux?

601


What does .sh file contain?

561


What is the significance of the shebang line in shell scripting?

537






What are the two files of crontab command?

656


What is in a script?

573


Rewrite the command to print the sentence and convert the variable to plural: echo “i like $variable”.

576


How does ls command work?

592


Is shell scripting a programming language?

581


How do you find out What is your shell?

592


What are the advantages of shell script?

529


What are the four fundamental components of every file system on linux?

1170


What is shift command in shell script?

535


What are script files?

558