[轉載] Linux下递归列出仅所有常规文件或文件夹路径的方法

Adam posted @ Sun, 21 Oct 2012 13:34:18 +0800 in Linux with tags bash linux , 2297 readers

 

看到他說的第一句話,非常感同身受啊。。。於是就轉載過來了。

感謝:http://jakwings.is-programmer.com/posts/35628.html

 

混蛋的,好不容易才知道,立刻发篇博文说一下……囧

 

## 只列出常规文件
find ./ -type f
 
## 只列出文件夹
find ./ -type d

find的man page介绍太长了,眼花缭乱(用zsh的可无视= =;)!百度和GOOGLE的结果也太烂了,几乎全是ls方法。

 

既然用到find了,就不得不提它的另一个功能了:

 

## 对找到的所有文件进行批处理
 
find . -type f -exec chmod 644 {} \; # 后面的\;必须的,表示按行输出
 
find . -type d -exec chmod 755 {} \; # {} 表示找到的文件路径

 

好了,暂时介绍完毕,大家还是继续man find去吧……

 


Login *


loading captcha image...
(type the code from the image)
or Ctrl+Enter