To search the whole filesystem (/
) for
- directories (
-type d
),
- called
app
(-name app
),
- that were modified more recently than one day (i.e., 24 hours) ago (
-mtime 0
),
...Use:
find / -name app -type d -mtime 0
Source: man find
.
In particular see the explanation of the -mtime
flag and the "find $HOME -mtime 0
" example:
[T]o match -mtime 0, a file will have to have a modification in the past which is less than 24 hours ago.
(Thus the time in days since the file was modified is rounded down to the nearest integer for purposes of being matched by -mtime
.)
Creation is considered a form of modification for the purpose of file timestamps, so this will work even if the file's contents weren't altered after it was created. It will also match folders with modification timestamps in the last day that were created earlier, but you probably don't have many such folders whose exact name is app
.
When a file was created is not typically stored in the filesystem. But the time at which its metadata were last changed (e.g., name/location, ownership, permissions) is stored. If you prefer to go by that to when the file's contents were modified, use -ctime
in place of -mtime
:
find / -name app -type d -ctime 0
For both -mtime
and -ctime
, the original creation of the file qualifies as a modification / status change.
find(1)
doesn't offer to search by birth time. That's why all answers are and will be about (status) modification time.-ctime
switch do then?-ctime n
: File's status was last changed […]” (emphasis added). Nothing about file creation time.-mtime
for modified and-ctime
for changed. <sarcasm>That sounds really great and absolutely not confusing.</sarcasm> Well, not your fault...-smtime
or something alike for file status modification time would be more intuitive.