Thursday, February 03, 2011

Finding files of a specific age

While fiddling around with FreeBSD, I wanted to remove a number (wasn't sure how many exactly) symlinks that I had produced two days previously.
As I didn't even note down the names of the files that I linked to, I was unsure how to make sure all were removed.
First I tried to identify all files that had been modified exactly two days ago in the target folder by using this command:

# find /usr/local/lib -mtime 2

This is a useful command of which more detail is available here.
Although this worked to an extent, it was complicated by the large number of subfolders which contained both files and links.
What worked better for me on this occasion was to open the folder in nautilus and select list view.
Then by clicking on the Date Modified tab, I got a chronologically ordered list from which I could very quickly select the links I wanted to remove.

No comments:

Post a Comment