Most recently modified directory in a folder

(imported topic written by u78274491)

I need to find out which directory was most recently created or modified in a directory and report it along with it’s date and time on a Solaris system to know when the last patch was applied to a system. Essentially it’s an ‘ls -lrt /var/sadm/patch | tail -1’. I’ve found a way of listing what’s under the top level folder (/var/sadm/patch), but I only want to know about the directories under there and whose the latest. Any help greatly appreciated.

(imported comment written by NoahSalzman)

You might try using this relevance:

name of (folders of folder “/var/sadm/patch”) whose (modification time of it = (maximum of (modification times of (folders of folder “/var/sadm/path”))))

You can also use “creation time” or “accessed time” instead of modification time.

Noah

(imported comment written by NoahSalzman)

I just reread your post and saw you want to return the time stamp as well. To do that just change

“name”

at the start of the script to

“(name of it, modification time of it)”

Noah

(imported comment written by u78274491)

Noah, that’s brilliant, thanks ever so much for that it works brilliantly. =)