[Tutor] reading file creation date and xreadlines from a point in the middle of a file

Ramkumar Kashyap rkashyap@sympatico.ca
Wed, 06 Feb 2002 08:43:16 -0500


I would not know how you can call this in the middle of reading a file, 
but here is a small program that will list the name of the file and date 
created, in fact lists the entire contents of a directory.

I don't know if it works on cross-platform, but works on win32.

import os
import time

DIR = "D:\\my_dir"
for filename in os.listdir(DIR):
    full_path = os.path.join(DIR, filename)
    created = os.stat(full_path).st_ctime
    print filename + ",", time.ctime(created)

regards,

Kumar