Delete files according to date

Hi All,

I am wondering whether is there a way to remove files according to date. For example, I have 500 files between Jan - April, and I want to remove files created only on March.

Is there any way to do this?
Thanks in advanced.

rgds,
Ronny

If all the files are for the same year:

ls -lrt | awk '$6 ~ /Mar/{print $9}' | xargs rm -f

or else, you will need to use find with mtime option
for example, if you want to run the command today:

find /dir/ -type f -mtime +38 -mtime -69 -print -exec rm -f {} \;

before that verify the files using

find /dir/ -type f -mtime +38 -mtime -69 -print -exec ls -l {} \;

and tweak the numbers.

cheers,
Devaraj Takhellambam

if you have Python installed on SUN, here's an alternative

#!/usr/bin/env python
import time,os
for r,d,f in os.walk("/your/path"):
    for files in f:
        t=os.path.getmtime(os.path.join(r,files))
        if "Mar" in time.ctime(t):
            os.remove(os.path.join(r,files))