#1
|
|||
|
|||
shell script question
trying to write a shell script to automatically backup & then delete old backups. Got the auto-backup part, but the deleting old files will go something like this:
list contents of directory in a single column (ls -1 /path/to/dir) output looks like this: file_2007.11.01.tgz file_2007.11.02.tgz file_2007.11.03.tgz ..etc Take the date part of the filename (i.e. YYYY.MM.DD) and assign them to an array, so that I can go through the array and find the ones that are X days older than today's date. Then the script deletes the files with these dates in the name. I know how to put current date into a variable, I just don't know how to take those files, and piecemeal them so that I can I can take action on them. Ideas? Buzz |
|
|