Sorry, that should be ls -ltr to put them in reverse time order. Of course, you 
can use ls -lt and head as an alternative (:

Steve

On Tue, 24 Jul 2007 09:03:13 +1200
Steve Holdoway <[EMAIL PROTECTED]> wrote:

> ls -1r | tail -n xxx | xargs rm -f
> 
> should do it ( or similar - the tail -n syntax varies over different versions 
> of linux to check ). However, why not just put them in subdirectories unique 
> to the day. Much simpler, and could be a lot more efficient if you're talking 
> a lot of files.
> 
> Steve
> 
> 
> On Tue, 24 Jul 2007 08:55:22 +1200
> Roger Searle <[EMAIL PROTECTED]> wrote:
> 
> > Hi, I have a bash script that functions very well backing up a bunch of
> > folders on a few machines.  Each day's files are unique so after a
> > couple of weeks the drive storing them fills.  I have no need to retain
> > the oldest files as they are regularly put on DVD and stored elsewhere,
> > with a separate weekly or monthly archiving system to a different machine.
> > 
> > How can I, via the script, delete the oldest x files in a folder?
> > Trivial task in konqueror, somewhat problematic when I forget though . . .
> > 
> > Cheers,
> > Roger

Reply via email to