Need to find created date of file in UNIX

[FONT=Arial][SIZE=7][COLOR=Blue]

I need to write a script which has to list all the files which are created before six months from now.

kindly help on this ...

UNIX does not have a created date. What you want is the last time the file was modified - that date. Using 180 days for six months (you can adjust the number)

find /path/to/directory  -mtime +180

lists all of the files older than six months.

find /path/to/directory  -mtime +180 -exec ls -l {} \;

gives a long directory listing... so you can verify dates.

How can I delete these files once i get from this find command.

kindly assist please.. this is an urgent issue

for any 'urgent' issue try to understand a given hint, browsE the relative 'man' pages' for further help and come back with specific questions.

You can remove file in a similar way mcnamara suggested.

find /path/to/directory -mtime +180 -exec rm {} \;

remember here it is necessary to give semicolon and has to be preceded by \ to take away its special meaning.here {} indicate that searched files would become arguments for rm.

find /path/to/directory  -mtime +180 -exec rm -f {} \;

Use ctime instead of atime. I'm also assuming that you meant "created more than six months ago," because everything was created before six months from now."

find . -ctime +180

If you have a large number of files, try:

find /path/to/directory  -mtime +180 | xargs rm -f

It'll keep you from forking rm for each and every file. It "batches" them together as much as possible.