I\'m currently using the following command to list some directories:
dir /b /s /AD > c:\\temp\\dir_list.txt
This gives me almost the lis
Here is a solution which based on the depth first listing solution of @dbenham,
and enables to set minimum level as well.
@echo off
setlocal
set currentLevel=0
set maxLevel=%2
if not defined maxLevel set maxLevel=1
set minLevel=%3
if not defined minLevel set minLevel=0
:procFolder
pushd %1 2>nul || exit /b
if %currentLevel% lss %maxLevel% (
for /d %%F in (*) do (
if %currentLevel% geq %minLevel% echo %%~FF
set /a currentLevel+=1
call :procFolder "%%F"
set /a currentLevel-=1
)
)
popd
To set the minimum level just provide it as 3rd parameter.
For example: to list from level 2 to level 5, you could use
listDirs.bat target_path 5 2
Alternatively, you can list from the base level by leaving this parameter empty
listDirs.bat target_path 5