linux如何查找具体文件在特定文件夹中

linux如何查找具体文件在特定文件夹中,第1张

概述这是我的文件夹结构: /site1/myFolder/otherFolder1/a.gif /site1/myFolder/otherFolder1/b.png /site1/myFolder/otherFolder1/c.php … /site2/myFolder/otherFolder2/d.gif /site2/myFolder/otherFolder2/e.png /site2/myFol 这是我的文件夹结构:

/site1/myFolder/otherFolder1/a.gif

/site1/myFolder/otherFolder1/b.png

/site1/myFolder/otherFolder1/c.PHP

/site2/myFolder/otherFolder2/d.gif

/site2/myFolder/otherFolder2/e.png

/site2/myFolder/otherFolder2/f.PHP

/site3/myFolder/otherFolder3/g.gif

/site3/myFolder/otherFolder3/h.png

/site3/myFolder/otherFolder3/i.PHP

得到这么远

find /var/www/HTML -type d -name myFolder -exec find {} -name "*.PHP"  \;for i in `find /var/www/HTML -type d -name myFolder -exec find {} -name "*.PHP"  \;`  do    some_house_keePing_here  done

但是我想做这样的事情:

find /var/www/HTML -type d -name myFolder -exec find {} -name "*.PHP" -exec do_some_housekeePing {} \; \;
解决方法 您可以使用-path选项而不是-name.它将匹配整个绝对路径与正则表达式.
find /var/www/HTML -path "*/myFolder/*.PHP" -exec do_some_housekeePing {} \;
总结

以上是内存溢出为你收集整理的linux如何查找具体文件在特定文件夹中全部内容,希望文章能够帮你解决linux如何查找具体文件在特定文件夹中所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/yw/1048674.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-25
下一篇 2022-05-25

发表评论

登录后才能评论

评论列表(0条)

保存