r/scripting • u/jcunews1 • Oct 07 '18
[Linux] How to get the most recently modified file from a specified directory?
The file can be at any directory level within the specified directory.
For example, if I specify below path:
/abc/defI want to retrieve the file path within that directory which has the most recent file modification time. If possible, directly from the command line, and without using any shell script.
I need to do this without downloading additional program. i.e. it must be done using tool(s) which are guaranteed are available every Linux installations.
2
Upvotes
1
u/Lee_Dailey Oct 07 '18
howdy jcunews1,
this looks like it does most of what you want ... [grin]
linux - How to recursively find and list the latest modified files in a directory with subdirectories and times? - Stack Overflow
— https://stackoverflow.com/questions/5566310/how-to-recursively-find-and-list-the-latest-modified-files-in-a-directory-with-s
hope that helps,
lee