ksh: How to get latest file from a list of files in a directory

Hi,

I need to get the latest file from a list of files in a particular directory.

Please could anyone help me out to get the file.

Thank you,

  • Jay.

See the man page for the ls command - note the -t and -r options.

-t Sorts by time stamp (latest first) instead of by name.
The default is the last modification time. (See -u and -c.)