List files in all subfolders

Status
Not open for further replies.

Ruriko

Active Member
787
2008
33
4,435
I have a directory with a bunch of subfolders (contains special/chinese characters) I want to create a txt file in each subfolder that will list all the files in that subfolder. I am running Windows Server 2003. How can I do this with CMD? or any other tools
 
7 comments
Just use the other one I made and add the dir like this
Code:
@setlocal EnableDelayedExpansion
@echo off
chcp 65001 > nul
for /F "delims=" %%a in ('dir /ad /b /s') do ( @echo %%~nxa > %%a\test.nfo
dir /b %%a\*.* >> %%a\test.nfo  )
 
If you have sub folders in folders it will show those along with the file names. It is working fine for me..

Let me add the chinese folders back and see how it works..

Ok try this one
Code:
@echo off
chcp 65001 > nul
for /F "delims=" %%a in ('dir /ad /b /s') do (
pushd somedir
cd %%a
for /f "delims=" %%f in ('dir /b /a-d-h-s') do ( @echo %%~nxa > test.nfo 
@echo %%f >> test.nfo)
popd
)
 
Last edited:
Status
Not open for further replies.
Back
Top