You want to use 'find'. man find for all the details... find ./* -mtime +10 -maxdepth 0
This finds all files in the current directory older than 10 days. ./* says to look at all files (not dot files) in the current directory. If you want dot files too, do only ./ -mtime +10 means last modified time more (+) than 10 days old -maxdepth 0 says don't go into subdirectories. You can use find's -exec of -ok arguments to move those files, but I'm not sure exactly how to throw that into the mix. -Rob > On 20020311.2150, Grigsby, Garl said ... > > I have a question on a shell script I am trying to piece together (and > it must be a shell script. I am trying to find time to learn Perl, but > at this point it looks to me like a cat walked across a keyboard....). I > need to go through a directory and move any file older than 10 days. How > do I go about this? I know that I can get the date from 'ls -l', but I > don't know how to use this in a comparison? I know that I could probably > come up with a really (really) ugly set of logic statements, but there > has got to be an easier way. Anybody want to share their thoughts/ideas? > Please? > > Garl "Who is not quite as good as Jamie" > > > > ======================================================================= > Garl R. Grigsby > Senior Customer Applications Engineer - I-DEAS CAE & FEMAP Support > ----------------------------------------------------------------------- > EDS PLM Solutions Phone: (800)955-0000 > Global Technical Access Center FAX: (541) 342-8277 > 1750 Willow Creek Circle Email: [EMAIL PROTECTED] > Eugene, OR 97402 Internet: http://www.plmsol-eds.com > ======================================================================= > -FEA makes a good engineer great, and a poor engineer dangerous- > ======================================================================= >
