[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

RE: achive and remove old files

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 redhat com
[mailto:redhat-list-bounces redhat com] On Behalf Of Jianping Zhu
Sent: Wednesday, January 05, 2005 9:37 AM
To: redhat-list 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

redhat-list mailing list
unsubscribe mailto:redhat-list-request redhat com?subject=unsubscribe

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]