Shell script to find out 2 last modified files in a folder..PLZ HELP!!!!!!!!!

hi all,

I need to find out the last 2 modified files in a folder.There is some way by which,we can check the timestamp and find out..??please help this is urgent.

Thanks in Advance

Anju

As simple as

ls -Atr | tail -2

Dear Anju,

to get the timestamp of a file, try this,

ls -l filename|awk '{print $6$7$8}'

then the result will be in the format of MonDDYY
here in the place of YY u'll get the time of the file creation if the file get created within 6 months. if the file got created before 6 months then in the place of YY value will be the year(2007 etc)

Regards,
Pankaj

try this also

ls -lt |head -2

Regards,
Pankaj