My folder parent
has the following content:
A.Folder B.Folder C.File
It has both folders and files inside. B.Folder
is newer. Now I just want to get B.Folder
, how could I achieve this? I tried this,
ls -ltr ./parent | grep '^d' | tail -1
but it gives me drwxrwxr-x 2 user user 4096 Jun 13 10:53 B.Folder
, but I just need the name B.Folder
.
Best Answer
Try this:
-t
options makels
sort by modification time, newest first.If you want remove
/
: