Solução rápida usando o comando tree
para imprimir a estrutura de diretórios.
@echo off
:: for each directory...
for /d %%D in (*) do (
:: we'll go into it...
cd %%~nxD
:: use the 'tree' command to output its
:: structure in a nice way...
tree /a /f > ..\%%~nxD.txt
:: go back...
cd ..
:: remove the first 3 (useless) lines from the 'tree' output
echo %%~nxD > stackoverflowrules.tmp
for /f "skip=3 delims=*" %%a in (%%~nxD.txt) do (
echo.%%a >> stackoverflowrules.tmp
)
copy /y stackoverflowrules.tmp %%~nxD.txt
del /f /q stackoverflowrules.tmp
)