On Thu, Aug 31, 2006 at 03:02:28PM +1000, Kevin Saenz wrote: > Hi all > > I would like to move files from /home directories where files haven't been > touched for 2 years I am thinking that I need to use something like > > find /home -mtime -500 -exec mv > > am I on the right track?
Sorta :-) For mtime, - means less than, means greater than. You want greater than. Where do you want to move them to? Best to just tar/cpio them up because if you attempt to move them the destination dir may not exist. Using cpio/tar creates the necessary structure implicitly. Also it only makes sense for files not dirs. Say you have an /homearchive dir. Then the following should be good: cd /home find . -type f -mtime +730 -print0 >oldfiles cpio -pmv0 < oldfiles /archivehome # check to see if things look ok then ... cd /home xargs -0 rm < oldfiles If you want a more precise time, then you can touch a file with the exact mtime then use ! -newer somefile (not newer, aka older) Matt -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
