前端之家收集整理的这篇文章主要介绍了
bash – 查找不是目录本身的目录中的所有文件,
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在寻找一种
方法来列出目录中的所有
文件,不
包括目录本身以及这些子目录中的
文件。
@H_
301_1@所以如果我有:
./test.log
./test2.log
./directory
./directory/file2
@H_
301_1@我想要一个返回:./test.log ./test2.log的命令,没有别的。
如果你想要test.log,test2.log和file2那么:
find . -type f
@H_
301_1@如果你不想要file2那么:
find . -maxdepth 1 -type f