Finding files modified within a specific time period
Posted: April 21, 2018 Filed under: Computers, Linux Leave a comment »I had been working experimentally on a file a couple of days ago and forgot to change the name to something meaningful. I remembered roughly when I was working on it and would recognise the name and context when I saw it (probably). But the problem is how to you find the relevant files? Stackoverflow to the rescue (as always), with a bit of man find
:
find /home/dan/ -name *.xml -mtime -2 -ls |more
It’s all pretty self explanatory except the -mtime -2
: the utility, the start directory, any restrictions on the file name (you want to use this if you are searching a home directory: I have 10k+ files, it looked like before I added it, given all the cache files from the web browsers), the time period in days (-mtime), and a ls-style display. |more is a pipe that allows you to look at the output in segments if there is more than a screen’s worth.
-mtime
is the only funny bit: it searches back the number of days expressed by its value. If the value is positive, it searches bac Read the rest of this entry »