You're viewing a comment by pradeep.aradhya and its responses.

pradeep.aradhya Permalink
June 27, 2011, 09:46

Hi Peter i have a question
I have to delete a file by comparing today's date with the date in file if it is older than 7 days then delete it. Is it possible

Comment Responses

June 28, 2011, 16:02

Awk is not the language for this. You want to use the find utility and combine it with rm.

Here is how to do it:

find /path -ctime -7 -exec rm {} \;

Note: If you use rm, always substitute -exec with -ls to make find will remove the right files!

Reply To This Comment

(why do I need your e-mail?)

(Your twitter handle, if you have one.)

Type the word "cdrom_257": (just to make sure you're a human)

Please preview the comment before submitting to make sure it's OK.