Two Plus Two Newer Archives  

Go Back   Two Plus Two Newer Archives > Other Topics > Computer Technical Help
FAQ Community Calendar Today's Posts Search

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 11-13-2007, 02:53 PM
B2_eBoogaloo B2_eBoogaloo is offline
Senior Member
 
Join Date: Oct 2007
Location: procrastinating 7K
Posts: 187
Default 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
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 09:02 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.