in reply to Re^2: Finding Oldest File in a Directory
in thread Finding Oldest File in a Directory

almost...
ls -td *BOT* | head -1
Or you'll get the first file in the oldest directory containing BOT in its name (assuming no file whose name contains BOT is older)

This still has the possibility of returning a directory name though. Under Unix, this still is a file, although when people say "file", they usually want to exclude directories.

Perl --((8:>*

Replies are listed 'Best First'.
Re^4: Finding Oldest File in a Directory
by Moron (Curate) on Oct 06, 2005 at 09:47 UTC
    No, the -d option specifically limits the output to directories only, not its absence as you imply.

    -M

    Free your mind

      No, the -d option specifically limits the output to directories only, not its absence as you imply.
      I know. That's why I wrote: This still has the possibility of returning a directory name though. -d implies that ls won't show the content of the directories, just the name. Which is exactly what I intended.
      Perl --((8:>*
        What I am trying to draw your attention to is that it has ONLY the possibility of returning directory names which is not what the OP is asking for.

        -M

        Free your mind

          A reply falls below the community's threshold of quality. You may see it by logging in.