I need to find files modified in the last 12 hours. However, the directory is quite large, so using the regular find command takes too much time.
Anyone have any ideas making this faster? I thought of something like listing files, and then using my head to get the top 20, and then checking only those files. But I'm not sure.
Any help?
UPDATE: thanks to the help of the selected answer, we found out that you can find the file without using the find command. The trick is to timestamp file names, and then use the following code to get the latest version:
ls -1 /directory/files*.txt | sort -nr | head -1
source
share