我想列出文件夹中的文件,但不列出子文件夹.DIR使您能够列出特定类型的文件(隐藏,存档就绪等),也只列出文件夹,但我看不到如何只列出文件.
我需要以下语句来返回文件以进行进一步处理,但是文件夹名称搞乱了!
for /f %%a in ('dir /b %csvPath%') do (
)
Run Code Online (Sandbox Code Playgroud)
JJ.*_*JJ. 32
dir /b /a-d将为您提供没有目录的文件.请注意,两者之间没有空格/a-d.' - '表示"NOT"目录.
从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).
Run Code Online (Sandbox Code Playgroud)
小智 5
dir /b /s /a-d
Run Code Online (Sandbox Code Playgroud)
/s 列出每个目录以及包含文件的所有子目录,以及(ad)没有空目录的目录。
dir /b /s /a-d /p
Run Code Online (Sandbox Code Playgroud)
/p 暂停
dir /b /s /a-d > list.txt
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
31217 次 |
| 最近记录: |