Finding the oldest file in a particular directory

Hi all,

I am a newbie to scripting and I need your help regarding finding the oldest file in a particular directory. My intention is to remove that oldest file.

Are there any options available with the "find" command to do this..

Thanks in advance for your help

Pavan

ls -1 -t | tail -1

Thanks a lot shereenmotor.

We can use the below command also for find the latest file in particular directory

ls -gt | tail -1

Hi,

Try the below command

ls -ltr | head -1