Return to Snippet

Revision: 30826
at August 23, 2010 13:21 by throb


Initial Code
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

Initial URL


Initial Description


Initial Title
Search for files with a specific extension and put them in a list

Initial Tags
python

Initial Language
Python