linux find prune exec 排除某目录或文件 执行
来源:互联网 发布:指南针导入指标源码 编辑:程序博客网 时间:2024/05/15 23:47
查找cache目录下不是html的文件
- find ./cache ! -name '*.html' -type f
列出当前目录下的目录名,排除includes目录,后面的-print不能少
- find . -path './includes' -prune -o -type d -maxdepth 1 -print
排除多个目录,”(“前是带”\”的
- find / \( -path /home/ -o -path /root \) -prune -nouser -type f -exec ls -l {} \;
find查找文件的时候排除某个或几个文件或目录
比如要在/usr/sam目录下查找不在dir1子目录之内的所有文件
find /usr/sam -path "/usr/sam/dir1" -prune -o -print
find [-path ..] [expression] 在路径列表的后面的是表达式
-path "/usr/sam" -prune -o -print 是 -path "/usr/sam" -a -prune -o -print 的简写表达式按顺序求值, -a 和 -o 都是短路求值,与 shell 的 && 和 || 类似如果 -path "/usr/sam" 为真,则求值 -prune , -prune 返回真,与逻辑表达式为真;否则不求值 -prune,与逻辑表达式为假。如果 -path "/usr/sam" -a -prune 为假,则求值 -print ,-print返回真,或逻辑表达式为真;否则不求值 -print,或逻辑表达式为真。
这个表达式组合特例可以用伪码写为
if -path "/usr/sam" then
-prune
else
-print
避开多个文件夹
find /usr/sam \( -path /usr/sam/dir1 -o -path /usr/sam/file1 \) -prune -o -print
圆括号表示表达式的结合。
\ 表示引用,即指示 shell 不对后面的字符作特殊解释,而留给 find 命令去解释其意义。
查找某一确定文件,-name等选项加在-o 之后
#find /usr/sam \(-path /usr/sam/dir1 -o -path /usr/sam/file1 \) -prune -o -name "temp" -print
linux下的常用命令find,加上不同的参数,可以使你很容易的找到需要的文件,但是有些时候,你在查找文件的同时,可能不需要在某文件夹下查找,这时候-prune就用上了。
比如在当前目录下寻找pl后缀的文件,不在scripts下寻找。
find . -path './scripts' -prune -o -name '*.pl' -print
0 0
- linux find prune exec 排除某目录或文件 执行
- linux find prune exec 排除某目录或文件 执行
- linux find prune exec 排除某目录或文件 执行
- linux find prune exec 排除某目录或文件 执行
- linux find 排除某目录或文件 执行
- linux find 命令避开某个目录的用法prune
- linux find 命令避开某个目录的用法prune
- Linux find 排除某个目录
- linux下打包文件排除指定文件或目录
- find查找文件的时候排除某个或几个文件或目录 (转载)
- find查找文件的时候排除某个或几个文件或目录
- Linux 使用tar打包排除指定目录或文件
- WinRAR压缩时排除文件或目录
- tar 排除某个文件或目录
- tar命令和排除目录或文件
- linux命令:递归删除某个文件或目录,拷贝时排除某个目录
- find:查找文件或目录
- Linux tar压缩时排除某个目录或文件的参数
- Android应用如何安装百灵欧拓sdk
- 致那些我工作过的设备
- 通用代码库之listview和GridView
- 周期串(注释代写)
- 什么是Category
- linux find prune exec 排除某目录或文件 执行
- real-time scheduler in xen--sedf
- ShopXP购物系统爆高危安全漏洞 SCANV团队独家提供解决方案
- NGUI动态添加
- java笔记桥接模式
- 项目 XXX 受源代码管理。向源代码管理注册此项目时出错。建议不要对此项目进行任何修改
- 菜鸟Android学习之路02——代码控制IU界面
- 浏览器点击链接后没反应
- Sublime Text3安装