击:如何只列出文件? [英] Bash: How to list only files?

查看:114
本文介绍了击:如何只列出文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何列出一个文件夹,但他们的文件夹或子文件并不是所有的文件。换句话说:我怎么能只列出文件

How can I list all the files of one folder but not their folders or subfiles. In other words: How can I list only the files?

推荐答案

使用找到

find . -maxdepth 1 -type f

使用 -maxdepth 1 选项确保你只能看看在当前目录(或者,如果你更换与一些路径,该目录)。如果你想在所有文件和子目录的完整递归上市,只是删除了该选项。

Using the -maxdepth 1 option ensures that you only look in the current directory (or, if you replace the . with some path, that directory). If you want a full recursive listing of all files in that and subdirectories, just remove that option.

这篇关于击:如何只列出文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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