I am new to scripting in linux and I'm juming in head deep.
I have a script that:
stores date to variable
"DATE=$(date +%m-%d-%y_%H:%M)"
creates folder using the variable as the folder name
and then copys the files into that folder
"cp $source/file $target/$DATE/file"
I have the script running and I found a problem. After a few months I start running out of drive space. I only need to have 7 days of backup but I can only get on the server to delete the older folders every 4-7 weeks.
What I need is a command operator that will reed the name of all folders in my archive folder and test if that folder is older than 'x' days and delete it.
I am trying to learn how to read the man pages to write a file like this so if you would be so kind as to explain your code I would appreciate it.
Bookmarks