How to list the newest files in a folder, including all sub folders - Noob vs. Pro

AI Noob Answer:

"you can use "find" on Linux and MacOS:

find /path/to/directory -type f -printf '%T+ %p\n' | sort | tail -n 10 ... it works, but too complicated.

The "-type f" option tells find to search only for files, not dirs. The "-printf '%T+ %p\n'" option tells ... blabla ...

On Windows, you can use "forfiles":

forfiles /S /M *.* /C "cmd /c echo @fdate @file" /D +0 /O:D ... non functional garbage, producing error: invalid option '/O:D'

Is that helpful? Not really.

It's as stupid as: "Build a robot and train his AI to type DIR /OD for every folder and subfolder, rememember the newest files therein, then think of the overall newest files and write that into a file. Should only take five years."


 

Pro Answer:

Forget the above junk, download the free open source SFK for any system and type:

sfk late mydir

Done. Example output:

2023-01-24 18:07:14 mydir\foo.txt
2023-01-24 18:07:18 mydir\bar.txt
2023-01-24 18:13:53 mydir\hoo.txt

sfk late is an alias for
   sfk list -late.

Read all details here.

Users stare in shock and awe!
   How to search a phrase in all text files of a folder

Office workers cannot believe!
   How to list sub directory sizes in megabytes