I need my for loop to do 2 things at a time. I have a script where I move the old files into archive directory and then i want to compress them. Presently I am using 2 for loops for it. How can i do it in 1 for loop.
Code:
after this i am compresing them in another for loop:
Thanks that is working fine but have another problem. After compressing the files i am purging the files older than 30 days. I want to purge files only in the pattern of targetfilepattern in the script. But it's purging all files older that 30days. How do I make sure that it purges only the files that match my pattern. Here is my script: