I got a script that lists all subdirectories in a folder and put them in a file:
dir "\\test\e$\1" /a:d /s /b | sort>"C:\folders.txt
effect looks like this:
\\test\e$\1
\\test\e$\1\target1
\\test\e$\1\target1\in
\\test\e$\1\target1\out
\\test\e$\1\target2
\\test\e$\1\target2\in
\\test\e$\1\target2\out
\\test\e$\1\target3
\\test\e$\1\target3\in
\\test\e$\1\target3\out
\\test\e$\2
\\test\e$\2\target1
\\test\e$\2\target1\in
\\test\e$\2\target1\out
\\test\e$\2\target2
\\test\e$\2\target2\in
\\test\e$\2\target2\out
\\test\e$\2\random_folder_without_in_subfolder
what I really need:
\\test\e$\1\target1
\\test\e$\1\target2
\\test\e$\1\target3
\\test\e$\2\target1
\\test\e$\2\target2
even better (if possible) in this form (separator: "|:"):
\\test\e$\1\target1|:\\test\e$\1\target2|:\\test\e$\1\target3|:\\test\e$\2\target1|:\\test\e$\2\target2
You would need to change the setting of
sourcedir
to suit your circumstances.May have problems with directorynames containing characters that have a special meaning to
cmd
.