我正在尝试获取Windows目录中每个目录和子目录下的所有文件的列表。我知道如何列出所有文件和文件夹以及文件路径,但我只需要所有子目录下的文件名。所有文件都以“.tif”扩展名结尾。
答案 0 :(得分:4)
dir /s /b *.tif
有时咨询帮助确实帮助:
> help dir
Displays a list of files and subdirectories in a directory.
DIR [drive:][path][filename] [/A[[:]attributes]] [/B] [/C] [/D] [/L] [/N]
[/O[[:]sortorder]] [/P] [/Q] [/R] [/S] [/T[[:]timefield]] [/W] [/X] [/4]
...
/B Uses bare format (no heading information or summary).
...
/S Displays files in specified directory and all subdirectories.
...