I'm trying to write a script which removes older files from a certain directory. Basically what I'm trying to do is run a Minecraft server, but previously the backup script I made filled up the HDD completely as there was no way for it to remove older backups on its own. So what I'm trying to do now is write a script which will take care of that.
The backup script puts a date on the end of the world file (so for example: world_2013-03-05), and I'm trying to remove any file older than the date the script is run (to keep the backups current but to avoid filling the hard drive up).
This is what I've got so far, but I know it wont work. I don't really know what to do to make it work (the variable "FILE" I didn't know what to add for that so it's currently empty still).
Code:REMOVE="$(rm -rf)" CHECK="$(ls /home/zukaro/Minecraft/Backup)" FILE="$()" if $CHECK < $(date +%F) then $REMOVE $CHECK else exit fi