禁止使用DIR列出目录名称 [英] Suppress directory names being listed with DIR
本文介绍了禁止使用DIR列出目录名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想列出文件夹中的文件,而不是子文件夹中的文件。 DIR
使您可以列出特定类型的文件(隐藏的,可存档的等),也可以列出文件夹,但是我看不到如何仅列出文件。
I want to list the files in a folder but not sub-folders. DIR
enables you to list specific types of files (hidden, archive ready etc) and also only folders but I cannot see how to list only files.
我需要以下语句来返回文件以进行进一步处理,但是文件夹名称搞砸了!
I need the following statement to return files for further processing, but folder names are messing things up!
for /f %%a in ('dir /b %csvPath%') do (
)
推荐答案
dir / b / ad
将为您提供不带目录的文件。请注意, / a-d
之间没有空格。 -表示 NOT目录。
dir /b /a-d
will give you files without directories. Note there is no space between /a-d
. The '-' says "NOT" directories.
从 dir /?
帮助信息:
/A Displays files with specified attributes.
attributes D Directories R Read-only files
H Hidden files A Files ready for archiving
S System files - Prefix meaning not
/B Uses bare format (no heading information or summary).
这篇关于禁止使用DIR列出目录名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文