achive and remove old files

Pettit, Paul ismanager at ccbnpts.com
Wed Jan 5 16:38:19 UTC 2005


Steve gave you a good example of how to remove the files. Try this to
"archive" them the same way:

find /<source>/<dir> \( -type f -a -mtime +730 \) -exec mv
--target-directory=/<archive>/<dir>/ {} \;

When doing the above be sure to have the archive dir in a different tree
than the source. If you try to archive the old files into a dir that is
in the source dir you will get "existing file" errors because it will
desend down your archive dir and try to move those files too. Also note
that moving the files will change their accessed timestamp (but not the
modified timestamp). I'm not sure the trailing slash in
'--targe-directory=' is needed but if your moving dirctories as well as
files it won't hurt and is probably prudent.

Paul Pettit
CCB Inc.


-----Original Message-----
From: redhat-list-bounces at redhat.com
[mailto:redhat-list-bounces at redhat.com] On Behalf Of Jianping Zhu
Sent: Wednesday, January 05, 2005 9:37 AM
To: redhat-list at redhat.com
Subject: achive and remove old files 


S redhat 9.0
I have a huge direcory (more than 30 GB) I want to take all the files
 and sub-dirctries which have not been modified or used for more than
  two year  out of the diretory and achive it then delete them them from
   the original direcoty. Does anyone have a script to do this kind of
   work?
        Thank
	

-- 
redhat-list mailing list
unsubscribe mailto:redhat-list-request at redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list




More information about the redhat-list mailing list