24

Wanted:

I want a listing of files with full paths listed out recursively in Windows 7 through the command prompt.

I DON'T want folders to be listed.

Attempt:

This got me all files, but also included the directories:

dir /b /a /s

Result:

C:\path1
C:\path1\file1.txt
C:\path1\path2
C:\path1\path2\file2.txt

Desired Output:

C:\path1\file1.txt
C:\path1\path2\file2.txt

Other Thoughts:

I'm thinking I could do a loop (here's some psuedo-code):

for /f %a in ('dir /b /a /s') do if something then @echo %~a endif

2
  • What OS are you using?
    – Ramhound
    Dec 7, 2015 at 18:53
  • I'm using WIndows 7
    – ScrappyDev
    Dec 7, 2015 at 18:58

1 Answer 1

36

dir /a-D /S /B will produce the result you want:

enter image description here

enter image description here

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.