Recursive structures
The find
command on Linux (and the dir /s
command on Windows) recursively descends into a directory; if there are a few subdirectories within command, then it descends into each subdirectory, one by one. If the subdirectories, in turn, have subdirectories, command goes into each one and repeats the process all over again till all the directories are traversed. Let's have a look at the following directory:
Given this directory, try the following command:
% find ./tmp -type f -exec wc -c {} \;
The find
command starts at the tmp
directory and applies the wc
command to each regular file (so for this example, skip directories).
The command enters in tmp
and finds a and c. As these are directories, the flow enters a first, and finds b and one.txt
. As directory b is empty, it looks at one.txt
for which the predicate type f
is true. So, the characters are counted for one.txt
, and then the flow comes back to a and recurs into...