Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

List all subdirectories in a directory in Python

import os
 
rootdir = 'path/to/dir'
for file in os.listdir(rootdir):
    d = os.path.join(rootdir, file)
    if os.path.isdir(d):
        print(d)
Source by www.techiedelight.com #
 
PREVIOUS NEXT
Tagged: #List #subdirectories #directory #Python
ADD COMMENT
Topic
Name
1+5 =