import os,time,re def list_content(folder): """list the folder content""" with open ('info.txt','w') as fh: for r,d,f in os.walk(folder): for j in f: #if f not in l: for i in re.findall('png',j): name = time.ctime(os.path.getmtime(os.path.join(r,j))) fh.write(str(name)+" "+j+'\r\n') if __name__ == "__main__": list_content(os.getcwd(