Directory and Sub Directory listing
Posted
by
shekhar
on Super User
See other posts from Super User
or by shekhar
Published on 2012-12-11T07:30:48Z
Indexed on
2012/12/11
11:06 UTC
Read the original article
Hit count: 314
I am trying to list the directory name (only name, not full path) and sub directories (only name, not full path) inside it. There is only one level of sub directories. I used below script to do this:
@echo off&setlocal enableextensions
for /r "PATH" %%G in (.) do (
Pushd %%G
for %%* in (.) do set MyDir=%%~n*
echo %MyDir%
popd
)
endlocal&goto :eof
The problem with the above script is that it is showing root directory with the full path. How can I just make it show the directories in relation to the one I am working in?
© Super User or respective owner