[英]Alternative way to find all files in a folder and subfolders
Is there any alternative for below command to find files in a folder and subfolders as well. 下面的命令是否还有其他选择,也可以在文件夹和子文件夹中查找文件。
find . | egrep '\./[^/]+/[^/]+/[^/]+'
Note: I don't want directories I want to get only files 注意:我不希望目录仅获取文件
Additionally, you could specify list of files extensions as your search options: 此外,您可以指定文件扩展名列表作为搜索选项:
find . -type f -name "*.js" -o -name "*.ros" -o -name "*.php"
Above example, would only display file names with *.ros, *.php, and *.js as file extensions under specific folder and subfolders. 上面的示例仅显示带有* .ros,*。php和* .js的文件名,作为特定文件夹和子文件夹下的文件扩展名。
Why don't you just use find? 您为什么不只使用find? I am not sure from your question if you want to limit the depth. 从您的问题中我不确定您是否要限制深度。 If so: 如果是这样的话:
find . -type f -depth 2 -print
If you just want to find files 如果您只想查找文件
find . -type f -print
If you just want to find directories 如果您只想查找目录
find . -type d -print
You can also use -ls if -print does not float your boat. 如果-print没有使您的船浮起,您也可以使用-ls。
find . -type f -ls
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.