import os, fnmatch df = open("colorprofiles.txt","w") cwd = os.getcwd() for dirpath,dirnames,filenames in os.walk(""): for filename in filenames: if fnmatch.fnmatch( filename, "*.icc" ) or fnmatch.fnmatch( filename, "*.icm" ): full = os.path.join(dirpath,filename) df.write( cwd + '\\' + full + '\n') df.close()