From: Scott Taylor Subject: Re: oldest file Date: Thu, 06 Feb 2003 08:37:55 -0800 Sender: linux-admin-owner@vger.kernel.org Message-ID: <5.1.1.6.0.20030206082853.01cef8c8@mustang> References: <20030206100116.GA11904@genestate.com> Mime-Version: 1.0 Return-path: In-Reply-To: <20030206100116.GA11904@genestate.com> List-Id: Content-Type: text/plain; charset="us-ascii"; format="flowed" Content-Transfer-Encoding: 7bit To: linux-admin@vger.kernel.org At 02:01 AM 2/06/03, Mat Harris wrote: >i am sure this has been asked before, but I can't find trace of it in any >archives. > >I need to find the oldest directory inside multiply subdirectories. Perhaps >I should explain... > >I have /home/cams/ >inside that dir is four other dirs: cam1 cam2 cam3 cam4 >inside each of those is a directory structure like: year/day-date/ > >i want to run a script that searches for the oldest day in each cam >directory. What happens if the oldest day is the only file and that file is today's? Wouldn't you rather just remove all files older than X number of days? You could do this with the find command; find files changed 20 days ago and more: find /home/cams/ -ctime +20 -exec rm -rf {} \; for more info: man find