• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 183
  • Last Modified:

Listing files using dir /s

This question is more out of curiosity, mainly because I could not make it work.  I am sure there is a batch file to do this, but I wonder if there is a command line command to; display only the file names under each subdirectory.  It would be a: dir /b  but once I add /s then the subdirectory path is listed for each file.
0
chima
Asked:
chima
  • 2
2 Solutions
 
Shift-3Commented:
Paste the script below into a text file with a .cmd extension.  Customize the value of the folder variable with the location of the folder to search under.  Running the script will echo just the filenames.


@echo off
setlocal
 
set folder=c:\files
 
for /F "tokens=*" %%G in ('dir "%folder%" /A:-D /B /S') do echo %%~nxG

Open in new window

0
 
silemoneCommented:
dir/s/w will give you only the file names
0
 
chimaAuthor Commented:
Shift-3, I will try this later on in the day.  silemone, thank you I appreciate your response.
0
 
silemoneCommented:
good luck

cheers...
0

Featured Post

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now