Globbing files by their creation date

skip at pobox.com skip at pobox.com
Tue Jan 16 08:44:29 EST 2007


    Thomas> I've used glob.glob to create a list of all files whose name
    Thomas> matches a substring, but I don't see how I can use it to
    Thomas> identify files by their creation date.

Sumthin' like:

    files = [f for f in glob.glob(globpat)
                   if os.path.getctime(f) > timethreshold]

Define globpat and timethreshold accordingly.  You sure you don't mean
modification time?  If so, change getctime to getmtime.

Skip



More information about the Python-list mailing list