List Subfolders in a Root Folder
The material in this document is for informational purposes only. Rampiva makes no representations or warranties with respect to this document or with respect to the workflow described herein. Rampiva shall not be liable for any damages, losses, costs or expenses, direct, indirect or incidental, consequential or special, arising out of, or related to the use of this material or the products described herein.
Description
This script will list all subfolders in a root folder, and will return the names of the subfolders as allowed parameter values.
Usage
Update the rootdir variable to point to the root folder that should be scanned.
Language
Python
Script
import os
result=[]
rootdir = 'D:\\Data'
for file in os.listdir(rootdir):
d = os.path.join(rootdir, file)
if os.path.isdir(d):
result.append(file)