Difference between revisions of "GNU Find Examples"

From Michael's Information Zone
Jump to navigation Jump to search
 
Line 1: Line 1:
 +
==Find files based on "creation" time==
 +
Normally I use ctime, but there was one directory that was constantly being changed. Ended up using mtime since the file contents never changed.
 +
<pre>
 +
find /somedir/ -type f -mtime -90
 +
</pre>
 
==Relative paths==
 
==Relative paths==
 
<ref>https://unix.stackexchange.com/questions/104800/find-output-relative-to-directory</ref>
 
<ref>https://unix.stackexchange.com/questions/104800/find-output-relative-to-directory</ref>
 
<pre>
 
<pre>
find /somedir/ -type f -mtime -90 -exec realpath --relative-to /somedir {} \;
+
find /somedir/ -type f -exec realpath --relative-to /somedir {} \;
 
</pre>
 
</pre>

Latest revision as of 11:16, 18 December 2019

Find files based on "creation" time

Normally I use ctime, but there was one directory that was constantly being changed. Ended up using mtime since the file contents never changed.

find /somedir/ -type f -mtime -90

Relative paths

[1]

find /somedir/ -type f -exec realpath --relative-to /somedir {} \;