cancel
Showing results for 
Search instead for 
Did you mean: 

script

SOLVED
Go to solution
ivy1234
Frequent Advisor

script

I have a directory there are many files are writing to it time by time, I would like to write a script to do that , can please provide the advise .

archive all files to one single file in every 30 days , and then remove these old files .
1 REPLY
James R. Ferguson
Acclaimed Contributor
Solution

Re: script

Hi:

You could use 'find' to collect the files into a list (if not too long) or into another directory; something like:

#!/usr/bin/sh
cd /oldpath && find . -xdev -type f -exec mv {} /newpath \;
tar -cvf /dev/rmt/0m /newpath
rm -rf /newpath
exit

You could 'cron' this to run every 30-days.

Regards!

...JRF...