First, I wasn't sure if belonged to StackOverflow or here, but figure this would be more applicable to server administration.
We have a .tar
backup file going to an offsite backup server each day as apart of our daily processing. These are relatively large files averaging between 25-30 Gigs. As result, we are only able to keep about 2 weeks of backups. Every Friday (yes, this is Friday), one will ssh to the remote the server, OpenSuse 12.1, and manually delete the files the week prior and keep the current week's data. There is a consistent naming scheme within the file with something like BACKUP<YYYYMMDD><Time stamp>
, for example.
BACKUP20121022268498.tar
BACKUP20121022268498.log
BACKUP20121023268498.tar
BACKUP20121023268498.log
BACKUP20121024268498.tar
BACKUP20121024268498.log
BACKUP20121025268498.tar
BACKUP20121025268498.log
BACKUP20121026268498.tar
BACKUP20121026268498.log
BACKUP20121029268498.tar
BACKUP20121029268498.log
BACKUP20121030268498.tar
BACKUP20121030268498.log
BACKUP20121031268498.tar
BACKUP20121031268498.log
BACKUP20121101268498.tar
BACKUP20121101268498.log
and so on.
Most of the time I would use the command rm *20121022*
in this example. Sometimes, like in this example, im even able to get away with using rm *201210[22-26]*
. Doing a quick google search on muddied the water for me. I'm basically trying set this up so that an intern can log in, and run script from the user directoy.
Is there an easy way to do this? Where do I start here? I'm familiar with using date functions in other languages, but I seem be at an impass as where to start here. I don't do alot of Bash scripting. Thanks.