How do I recursively list filenames (only) in DOS/Windows? [duplicate]

Possible Duplicate:
Get bare file names recursively in command prompt

I would like to recursively list all files in a directory, showing filenames only (without extensions and without the full paths). I'm using Windows/DOS.

The closest I could get with dir was dir /s /b, but it lists full paths and also shows the extensions.

Well, perhaps I could live with the extensions, but I must get rid of the paths!

Any ideas?


cd /d C:\Path\To\Source\Folder
for /r %i in (*) do @echo %~ni

If you need the list saved to a file, append >> C:\Path\To\list_file.txt to the end of the for command.

If you end up wanting the extensions, change %~ni to %~nxi

To use in a batch file, change all the % to %%


If you are willing to load powershell, this command should do it.

get-childitem "d:\acc" -recurse|foreach {$_.Basename}