HPE Community read-only access December 15, 2018
This is a maintenance upgrade. You will be able to read articles and posts, but not post or reply.
Hours:
Dec 15, 4:00 am to 10:00 am UTC
Dec 14, 10:00 pm CST to Dec 15, 4:00 am CST
Dec 14, 8:00 pm PST to Dec 15, 2:00 am PST
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...