I would like to find the most recently changed file in a directory, excluding hidden files (the ones that start with .) and also excluding directories.
This question is headed in the right direction, but not exactly what I need:
Linux: Most recent file in a directory
The key here is to exclude directories…
Like the answer there except without -A
Look at
man lsfor more info.To make it exclude directories, we use the -F option to add a “/” to each directory, and then filter for those that don’t have the “/”: