Java Reference
In-Depth Information
Table 1.3 Some find predicates
Option
Explanation
-type d
Is true if the file is a directory.
-type f
Is true if the file is a plain file (e.g., not a directory).
-mtime -5
Is true if the file is less than five days old, that is, has been
modified within the last five days. A +5 would mean older than
five days and a 5 with no sign means exactly five days.
-atime -5
Is true if the file was accessed within the last five days. The +
and - mean greater and less than the specified time, as in the
previous example.
-newer myEx.class
Is true if the file is newer than the file myEx.class .
-size +24k
Is true if the file is greater than 24K. The suffix c would mean
bytes or characters (since b stands for 512-byte blocks in this
context). The + and - mean greater and less than the specified
size, as in the other examples.
$ find . -name '*.java' -mtime +90 -atime +30 -print
./MyExample.java
./old/sample/MyPrev.java
$
This command printed out the names of two files that end with .java found
beneath the current directory. These files hadn't been modified in the last
90 days nor accessed within the last 30 days. The next thing you might want
to do is to run this command again adding something at the end to remove
these old files.
$ find . -name '*.java' -mtime +90 -atime +30 -print -exec rm '{}' \;
./MyExample.java
./old/sample/MyPrev.java
$
1.3.10
Most Linux shells—the command interpreters—can be considered program-
ming languages in their own right. That is, they have variables and control
structures— if statements, for loops, and so on. While the syntax can be subtly
different between shells, the basic constructs are all there.
The Shell Revisited
Search WWH ::




Custom Search