First off, you are going to want to put the year first or you will run into problems in the future, so just: mkdir save`date +%y%m%d` Then you can use the -d switch to specify what date you want: rm -rf save`date +%y%m%d -d "yesterday"` rm -rf save`date +%y%m%d -d "3 days ago"` rm -rf save`date +%y%m%d -d "3 months ago"` > -----Original Message----- > From: owner-kclug@marauder.illiana.net > [mailto:owner-kclug@marauder.illiana.net]On Behalf Of Eric R. > Sent: Thursday, February 13, 2003 12:54 PM > To: kclug@kclug.org > Subject: bash scripting question > > > Afternoon LugNuts, > > Ok, I have a group of directories named "save(and the date) i.e. > "save021303". > > Iv'e discoverd I can make the current days directory using: > > mkdir save`date +%D | cut -c 1,2,4,5,7,8` > > My question is, how would I delete the directory that is several days > old? i.e. save021003 > > rm -rf ?? > > Thanks for your time, > Eric > > >