EXPLANATION
Expressions in "find" are evaluated left to right. In the
command given, "-print" is the first action in the expression, so each
file found is printed. Each file is evaluated against "-mtime -10", but
no corresponding action follows the -mtime test. Adding "-ls" to the
end of the expression will make it clear, because those files with
modification dates of less than 10 days will then be listed again, but
in a different format.
Find and print everything below the current directory:
$ find . -print
.
./May
./May/file03
./May/file01
./May/file02
./May/file04
./June
./June/file03
./June/file01
./June/file02
./June/file04
./July
./July/file03
./July/file01
./July/file02
./July/file04
Test the "find" command, as given in the challenge:
$ find . -print -mtime -10
.
./May
./May/file03
./May/file01
./May/file02
./May/file04
./June
./June/file03
./June/file01
./June/file02
./June/file04
./July
./July/file03
./July/file01
./July/file02
./July/file04
Append another action for the "find" command, "-ls", which
will list those files again that have modification times of less than
10 days:
$ find . -print -mtime -10 -ls
.
2370731 4 drwxr-xr-x 5 dan users 4096 Jul 14 21:11 .
./May
2506551 4 drwxr-xr-x 2 dan users 4096 Jul 14 21:17 ./May
./May/file03
./May/file01
./May/file02
./May/file04
./June
2506552 4 drwxr-xr-x 2 dan users 4096 Jul 14 21:18 ./June
./June/file03
./June/file01
./June/file02
./June/file04
./July
2506554 4 drwxr-xr-x 2 dan users 4096 Jul 14 21:18 ./July
./July/file03
./July/file01
./July/file02
./July/file04
Understanding that the order of evaluation moves left to right is
critical. If the specified action had been "-delete", instead of
"-print", every file from the current directory down would have been
deleted.
http://man7.org/linux/man-pages/man1/find.1.html
Warnings:
Don't forget that the find command line is evaluated as an expression,
so putting -delete first will make find try to delete everything below
the starting points you specified.
See also:
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/find.html
https://www.gnu.org/software/findutils/manual/html_node/find_html/find-Expressions.html#find-Expressions
SOURCE
http://man7.org/linux/man-pages/man1/find.1.html