例子: find -name "CVS" -exec rm -f {} \;

 

操作-name和-exec两个参数组合,可以实现批量查找删除指定文件的方针。

要活用find,它是很壮大 的。

find [path...] [expression]

-name
pattern
Base of file name (the path with the leading directories removed) matches shell pattern
pattern. The metacharacters (`*', `?', and `[]') do not match a `.' at the start of the base name. To ignore a directory and the files under it, use -prune; see an example in the description of -path.
-exec
command ;
Execute
command; true if 0 status is returned. All following arguments to
find are taken to be arguments to the command until an argument consisting of `;' is encountered. The string `{}' is replaced by the current file name being processed everywhere it occurs in the arguments to the command, not just in arguments where it is alone, as in some versions of
find. Both of these constructions might need to be escaped (with a `\') or quoted to protect them from expansion by the shell. The command is executed in the starting directory.