I need to obtain a list of directories within a specific folder, without including subdirectories.
For example, consider the following directory structure:
A/B/C
A/D/E
A/F
A/regular-file.txt
If I want to obtain a list of directories within directory A
, the output should be: [B, D, F]
.
I've come across this thread, but it only discusses recursive calls. Is there an elegant way to obtain a list of directories within a folder without recursion?