Create BAT file to get directory listing up to 2nd level only -
I have a window directory inside it with 300 folders and 4 level folders within each folder. Do I need to list the folder up to 2 levels in a txt file only? I need the full path of each directory I would like to use it on a bat file or CMD line prompt. Former:
John completed the tester tester002 test003 tester004
Can someone help me do this?
AECO of satelokal set "sourcedir = U : \ Sourcedir "PUSHD" / s for "% sourcedir%" dellimus = "%% a IN ('dir / b / ad 2 ^ & gt; nul') DO ECHO %% ~ FA / F" Dellymes = "% % A IN ('dir / b / ad') DO (PUSHD "%% A" FOR / F "delims =" %% x IN '(dir / b / ad 2 ^ & gt; nul') DO ECHO %% ~ FX popd) Popped GOTO: EOF
This should work - you will need to change the settings of sourcedir
according to your circumstances.
Comments
Post a Comment