/ Published in: Python
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
import os def dirLS (dirPath, ext): files = os.listdir(dirPath) foundFiles = [] for curfile in files: try: prefix, frame, suffix = curfile.split('.') print suffix if suffix == ext : foundFiles.append(dirPath + '/' + curfile) except: '''''' if len(foundFiles) == 0: foundFiles == None return foundFiles files = (dirLS('c:/temp','exr')) for file in files: print file