[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bash script question

Since there is a lot of knowledge on this list, I thought I'd aske

This may be trivial, but I'm not even sure how to search for what I
want to do.

I have a directory of files that are created daily using 
filename-`date +%Y%m%d`.tar.gz so I have a directory with files whose
names advance from filename-20061201.tar.gz to filename-20061202.tar.gz
to filename-20061203.tar.gz and so on.  Based on the date in the
filename, I would like to delete any than are X days older than today's
date.  So, I'm not interested in the actual created/modified date, just
the numeric string in the name.

Despite working in Bash for the past ten years or so, my shell
scripting skills are poor.  Logically, this seems like a simple test of
whether the name is older than the current day - X, but I'm having
trouble putting this into a script.

- Nate >>

 Wireless | Amateur Radio Station N0NB          |  Successfully Microsoft
  Amateur radio exams; ham radio; Linux info @  | free since January 1998.
             http://www.qsl.net/n0nb/           |  "Debian, the choice of
             My Kawasaki KZ-650 SR @            |     a GNU generation!"
        http://www.networksplus.net/n0nb/       |   http://www.debian.org

Reply to: