0

I have been told never to parse ls, but I would like to use the last edited directory in myDir as a variable in my bash script. I know I could capture this via ls -ltr myDir | tail -n1 | awk '{print $NF}' but this parses ls. Is there a 'best way' to find the last edited directory inside of myDir?

drjrm3
  • 1,556

1 Answers1

0

you can use something like this:

find /target_directory -type f -mtime -2

this will search for all files that have been modified in the target_directory and the sub_directory in the last 2 days.

Jay T.
  • 211