读取文件夹内容和权限 [英] Reading folder content and permissions

查看:78
本文介绍了读取文件夹内容和权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想调整一个我正在创建的小程序。它将读取一个目录,如果它在具有可执行权限的目录中找到一个文件,它应该做一些事情。

展开 | < span class =codeLinkonclick =selectAll(this);>选择 | 换行 | 行号

解决方案

看看文件::查找 File :: Find :: Wanted 任何一个都可以简化这个任务。


--Kevin


我想调整一个我正在创建的小程序。它将读取一个目录,如果它在具有可执行权限的目录中找到一个文件,它应该做一些事情。

展开 | < span class =codeLinkonclick =selectAll(this);>选择 | Wrap | 行号


要传递-x等文件测试需要绝对文件名。这意味着您应该包含要传递的测试文件的完整路径,而不仅仅是文件名。

将代码更改为:

展开 | 选择 | Wrap | 行号

I want to tweak a small program I''m creating. It will read a directory and if it finds a file inside the directory with executable permissions it should do something.

Expand|Select|Wrap|Line Numbers

解决方案

Have a look at File::Find or File::Find::Wanted either one will make this task simple.

--Kevin


I want to tweak a small program I''m creating. It will read a directory and if it finds a file inside the directory with executable permissions it should do something.

Expand|Select|Wrap|Line Numbers


Absolute filename is required for a file test like -x to pass. That means you should include the complete path of the file for the test to pass, not just the filename.
Change the code to:

Expand|Select|Wrap|Line Numbers


这篇关于读取文件夹内容和权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆