Hi, thanks to everyone for their replies.

Steve Holdoway wrote:
> Need more coffee.
>
> ls -1tr - 1 entry per line, t ime order, r eversed.
>   
>> 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 (:
>>     
for the deletes I am doing:
ls -1t | tail -n 7 | xargs rm -f

for the logging (see below):
ls -t "${BACKUPDIR}" | head -n 14 >> $LOGFILE
(gives me newest file at the top of listing)
>>     
>>> ls -1r | tail -n xxx | xargs rm -f
>>>       
Jim Cheetham wrote:
>
> cron
>
> No idea if there's a GUI for it, there probabl;y is :-)
Is one of the things that webmin can do, personally I love the fact that
I can use :wq at the end of editing a crontab . . .
>
> However, your safest bet would be to make the old-file-deletion part
> of the archiving process, so that you *know* a file has been archived
> before you delete it. Nothing like automating the deletion, but
> leaving the archiving to me a manual task that gets forgotten once ...
>
> -jim
Excellent point of course.  What I hadn't stated was that the files were
also being copied to another machine's drive (and no automated deletion
planned on that one) and am manually logging the success (or otherwise)
of the previous night's backup.  So I have a degree of protection
there.  Made me consider the situation further though, and I have now
added to the script some basic logging to a (different) file to tell me
which files are being deleted, how much space is left on the drives
involved with df, and a listing of the newest files in both locations. 
This is all working like a charm, and is going to reduce/eliminate the
occurrence of failures in this backup routine due to zero free space.

Thanks again for all the replies.

>>>
>>> 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