cancel
Showing results for 
Search instead for 
Did you mean: 

Script Query

SOLVED
Go to solution
Duffs
Regular Advisor

Script Query

Hi,
I want to write a script that will move all files that are older than 3 days within a number of sub directories to another server location.

My thinking was that taking one dir at a time I will gather all files older than 3 days and put them into individual batch files i.e.
find . -type f -mtime +3 > batch.out
But how can I get the actual files listed in these batch files to copy onto another dir (even locally)? Anyone any ideas on the best way of doing this?
Regards,
D.
4 REPLIES
Pete Randall
Outstanding Contributor
Solution

Re: Script Query

for FILE in `find /dir_one /dir_two /dir_three -mtime +d`
do
cp $FILE /arc_dir
done


Pete

Pete
Michael Steele_2
Honored Contributor

Re: Script Query

Hi

scp -rp * remotehost:/copy_to_dir (* secure copy *)

find /dir -depth -name "back*" -type f -print | xargs tar -cvf back.tar

tar cf - /source_fs | remsh server "tar xvf -"

a) I use find . -depth -exec tar -cvf /tmp/file.tar {} \;

Then verify the contents with
tar -tvf /tmp/file.tar

Then ftp the tarball over and extract.

cd /dir/dir
tar -xvf file.tar
Support Fatherhood - Stop Family Law
James R. Ferguson
Acclaimed Contributor

Re: Script Query

Duffs
Regular Advisor

Re: Script Query

Thanks for all the suggestions and help on this, I definately now have enough info to take my pick of solutions for this one.
Regards,
Duffs