I have a base dir with the following structure:
name_a/foo/...
name_b/bar/...
name_c/baz/...
This base dir has many subfolders with names_X, and inside each of those, there is a single dir that contains also other files.
I´m trying to get a list with only the subdirs names, i.e., my goal is to print:
foo
bar
baz
, but I´m printing also the parents:
name_a
name_b
name_c
foo
bar
baz
I´m using this:
from pathlib import
target_path = Path("my_base_dir")
for p in target_path.glob("**/*"):
if p.is_dir():
print(p.name)
Any help will be much appreciated.