https://medium.com/@berrybearw/linux-faq-find-用法-a176c5e63001
find 用法
find 目录 参数 条件
介绍 : 找寻档案或目录在哪里
格式 find 目录 参数 条件
常用 找寻当下目录档案
find (找寻) . (当下所在目录) -name (档案名称为) 123find . -name '123'
模糊搜寻请搭配 正规表达式
找寻当下目录结尾是 123 档案find . -name '*123'
参考 :
https://blog.gtwang.org/linux/unix-linux-find-command-examples/
https://stackoverflow.com/questions/4210042/how-do-i-exclude-a-directory-when-using-find
find . -type d 'xxx*'
参数
目录搜寻层数maxdepth 第几层find . -maxdepth 1忽略特定目录-not -path 目录find . -name '123' -not -path './usr/*'
path 目录 -prune -ofind . -path ./usr -prune -o -name '123'
-user 使用者find . -user topstd -name '*' -exec ls -l {} \;
排除 使用者find . ! -user topstd -name '*' -exec ls -l {} \;
-szie 大小find . -size +10k
小于 10 kfind . -size -10k
https://stackoverflow.com/questions/38843212/how-to-use-echo-with-find-in-bash
The shell redirection, >>
is being done at first, a file named {}
is being created before even the find
starts and the strings (the number of files are in there) are being written to the file {}
.
You need:
find . -type f -exec bash -c 'echo "This file found" >>"$1"' _ {} \;