Unix删除当前目录可执行文件
2014-10-27 12:02
357 查看
On GNU versions of find you can use -executable:
find . -type f -executable -print
For BSD versions of find, you can use -perm with + and an octal mask:
find . -type f -perm +111 -print
In this context "+" means "any of these bits are set" and 111 is the execute bits.
Note that this is not identical to the -executable predicate in GNU find. In particular, -executable tests that the file can be executed by the current user, while -perm +111 just tests if any execute permissions are set.
Older versions of GNU find also support the -perm +111 syntax, but as of 4.5.12 this syntax is no longer supported. Instead, you can use -perm /111 to get this behavior.
--列出当前目录所有可执行文件
find . -type f -perm +111 -exec ls -l {} \;
--删除当前目录所有可执行文件
find . -type f -perm +111 -exec rm -f {} \;
find . -type f -executable -print
For BSD versions of find, you can use -perm with + and an octal mask:
find . -type f -perm +111 -print
In this context "+" means "any of these bits are set" and 111 is the execute bits.
Note that this is not identical to the -executable predicate in GNU find. In particular, -executable tests that the file can be executed by the current user, while -perm +111 just tests if any execute permissions are set.
Older versions of GNU find also support the -perm +111 syntax, but as of 4.5.12 this syntax is no longer supported. Instead, you can use -perm /111 to get this behavior.
--列出当前目录所有可执行文件
find . -type f -perm +111 -exec ls -l {} \;
--删除当前目录所有可执行文件
find . -type f -perm +111 -exec rm -f {} \;
相关文章推荐
- 使用shell脚本删除当前目录下.c文件对应的可执行文件
- 使用shell脚本删除当前目录下.c文件对应的可执行文件
- 批量删除当前目录下的可执行文件
- 一段可以在UNIX下,读取当前目录下所有文件(包括子目录中的文件)的文件名的程序
- 删除当前目录下除了system目录的其他文件
- 删除目录下所有文件和子目录(不包括当前目录)
- linux下用通配符删除当前目录下包括子目录的相同文件
- 获取当前正在执行的服务器应用程序根目录的物理文件系统路径
- debian在当前目录不用输入./执行文件
- linux系统中运行当前目录中的可执行文件
- 批外理 移动子文件夹下的文件到当前目录并删除子目录
- 进行DOS系统调用,删除一个当前目录下的文件
- 习题13:编写程序,使用File类实现删除当前目录下的所有文件。
- 用Batch删除当前目录下小于指定大小文件
- 一个自动化 编译当前目录所有cpp为可执行文件的makefie
- 删除当前目录下的文件,保留目录
- 删除当前目录下包含在目录的所有.的扩展名的文件
- 删除一个目录下面的所有可执行文件
- 快速便捷地删除当前目录下所有EXCEL文件中的所有公式。
- DOS:先进入 bat 文件的路径,然后执行 bat 文件,然后回到当前目录