Shell Command needed!

I have backup files with following formats:

userdata-20020604-0100.tar
userdata-20020605-0100.tar
userdata-20020606-0100.tar
userdata-20020607-0100.tar
userdata-20020608-0100.tar
userdata-20020609-0100.tar
userdata-20020610-0100.tar

using format: userdata-[date]-[time].tar

I set the backup script to do the job in cron and it all works fine.
but I wanted to keep the backups for only last 7days. so in this case, during the next backup, userdata-20020604-0100.tar to be deleted.

how do I add a command check the date and delete the oldest(7 day old) to my backup script?

Any suggestions?

 

 

 

 

Top