On Saturday 31 March 2012 20:06:30 Andreas wrote:
Hi,
I'd like to let cron clean up a directory that holds hourly backups. So there are 24 new files every day.
I'd need some scripting that sorts the content of this directory and then removes everything but the 5 newest files.
Is there a howto or even sample code that does this?
logrotate already does pretty much just that. As the name suggests, it is intended for log files, but there is nothing to say it couldn't be used for other types of files as well. If you're careful with the config file, it can be used for pretty much any situation where you have a regular input of files and you only want to keep the last few of them Anders -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org