对find参数-prune的理解
(PS:对find参数-prune的理解
-prune就像一个判断语 句,当发现-prune前面的表达式math时,执行到-prune之后就会输出一个1结果,如果shell的话,
可以使用echo $?来看结果,如果-prune后面跟的是-o选项,用c语言的语法来讲的话就是1 || -print,所以明显可以看到
当-prune前面的 表达式成立的话,就不会执行-o后面的内容了,如果不成立,即0 || -print,那么将打印输出,
另外需要注意的是-path路径不能加入 结尾的/,
比如路径/vobs/gliethttp/signature,不能写成/vobs/gliethttp/signature/,这是 硬性规定
find /vobs/tmp/ -path /vobs/tmp/signature -a -print
如果find .那么后面-path的必须使用相对路径./gliethttp
除 find中.之外,其他所有查找,比如find tmp或者find /vobs等,-path都必须使用绝对路径
)
显示除hid_uart开头的所有目录或文件,以及名为 signature的目录或文件之外的所有文件
find . \( -name hid_uart* -o -name signature \) -prune -o -print
显示除当前目录./signature之外的所有文件
find . -path ./signature -prune -o -print
只打印当前目录下的./signature目录
find . -path ./signature -prune -a -print
打印除.svn下的所有.c文件
find . -name .svn -prune -o -iname '*.c' -a -print
或者使用-path参数
find . -path ./.svn -prune -o -print
用-prune还以限制递归的深度,如只搜索当前目录下的文件而不递归到子目录:
find . \( -type d ! -name . -prune \) -o \( -type f -print \)
分享到:
相关推荐
在Windows中可以在某些路径中查找文件,也可以设定不在某些路径中查找文件,下面用Linux中的find的命令结合其-path -prune参数来看看在Linux中怎么实现此功能。 假如在当前目录下查找文件,且当前目录下有很多...
ts-prune 使用零配置删除Typescript项目中未使用的导出。 入门 ts-prune公开了一个cli,该cli读取tsconfig文件... " find-deadcode " : " ts-prune " } 如果要针对与tsconfig.json不同的Typescript配置运行: ts-p
安装$ npm i @slsplus/node-prune -g用法$ np -hUsage: np [options]Prune command for projectOptions: -v, --version output the current version -e --exclude < exclude> Glob of files that should not be ...
zfs-prune-snapshots 1w 与上述相同,但增加了详细程度,并且没有实际删除任何快照(试运行) zfs-prune-snapshots -vn 1w 删除tank1和tank2 /备份上超过3周的快照。 注意,该脚本将通过所有罐1及以下TANK2 /备份...
安装使用npm安装: npm install --save-dev serverless-prune-plugin 然后将插件添加到您的serverless.yml文件中: plugins : - serverless-prune-plugin 或者,使用Serverless插件命令(Serverless Framework 1.22...
删除Docker Swarm中没有至少一个容器的所有映像使用以下命令在Docker Swarm中部署Image-Prune: docker stack deploy -c image-prune-docker-swarm.yml image-prune
"find / -name walter find /home -amin -10 十分钟内访问过的文件 find /home -atime -10 十天内访问过的文件 find /home -cmin -10 十分钟内修改过的文件 find /home -ctime +10 十天内被改过、新增的文件 find /...
1、目录层级、文件类型、文件名过滤查找 find /data -maxdepth 1 -type f -name *.sh find /data -maxdepth 1 -type d -name code ...3、-path DIR -prune排除DIR目录,最后排除条件放前面 find /data -maxdepth 1
安装来自 : $ curl -sf https://gobinaries.com/tj/node-prune | sh 来自来源: $ go get github.com/tj/node-prune用法在您的应用目录中: $ node-prunefiles total 27,330files removed 3,990size removed 13 MB ...
git filter-branch --force --index-filter 'git rm -r --cached --ignore-unmatch doc/硬件设计/GS03_MB_V3.0设计文件' --prune-empty --tag-name-filter cat -- --all git push origin master --force rm ...
git-prune 修剪远程存储库(源)上的...用法 git-prune 如果ready/*模式中的任何分支超过 1 天,都将从origin删除。 任何其他分支,除了master ,如果超过 30 天,将从origin删除。 不会删除任何本地分支。 执照
ec2-prune-快照 如果您经常执行ec2-create-snapshot ,那么您需要在某个时候清除它们。 ec2-prune-snapshots消除了这样做的所有麻烦。 特征 自动检测所有卷 确保每个卷的最新快照不被删除 在过去[540]天的每个月的第...
Prune-and-search discuss Prune and Search Algorithm
serverless-plugin-typescript, 无服务器插件,支持零配置 serverless-plugin-typescript 无服务器插件,支持零配置特性零配置:不需要安装任何其他编译器或者插件就可以使用这个框支持ES2015语法 特性( export,...
仿照unix操作系统中的find命令,实现自己的一个find命令。find命令从指定的目录下开始,递归地查找指定文件。其命令格式如下: find PATH -option 参数 [-print] [-exec 命令 {} \;] PATH:查找的起始目录。 -option...
section ( ' news ' ).find() | prune([ ' title ' , ' body ' ]) | json_encode() | raw }} 上面的模板将从“新闻”部分获取所有条目,仅获取每个条目的title和body字段,然后将其输出到JSON。
$ find -name '*.sh' -exec cp '{}' /tmp ';' $ find -name "*.sh" -exec cp "{}" /tmp ";" ################################################## ### 在查找中排除指定的目录 #################################...
node-prune:轻松修剪来自node_modules文件夹的不需要的文件
修剪未使用的ConfigMap,Secret,Pod和ReplicaSet资源的kubectl插件kubectl-prune kubectl-prune是一个kubectl插件,用于修剪未使用的Kubernetes资源。 支持的资源:ConfigMap秘密Pod复制副本集PodDisruptionBudget ...
要开始使用Styx,您需要熟悉和 。 构建环境。 初始化清单。 repo init -u https://github.com/styx-os/manifest -b R 同步源。 repo sync -j$(nproc --all) --force-sync --no-tags --no-clone-bundle --prune -...