Op woensdag 27 april 2005 04:27, schreef Arie Reynaldi Z:
Hi all,
I have made a script for backup purpose, so it will backup my folder daily and creates files like this : -rw-r--r-- 1 root root 97751911 Apr 25 17:27 stock-25-Apr-2005_17-25-33.tgz -rw-r--r-- 1 root root 97754710 Apr 26 17:11 stock-26-Apr-2005_17-00-00.tgz
Then after certain period, like weekly or monthly, I want to delete the oldest file. Now, how can I make a script to do that job ? I know the crontab can do it, but how can I remove just the oldest file automaticly, not whole file or directory ?
regards,
-- Arie Reynaldi Zanahar reymanx at gmail.com http://www.reynaldi.or.id
Perhaps, something similar to: find ${BACKUP_DIR:-/tmp/000} -name "*daily*" \ -mtime +7 -exec /usr/bin/safe-rm {} \; # Remove the directory when it is empty find ${BACKUP_DIR:-/tmp/000} -depth -type d -empty -mindepth 1 \ -exec /usr/bin/safe-rmdir {} \; -- Richard Bos Without a home the journey is endless