trying to check the creation date of a file

David Fickbohm DavidF at
Fri Aug 19 23:56:37 CEST 2005


I am trying to determine the creation date of files in a folder. 
I am using the following code to find the folder and confirm that files
exist in the folder.  If someone could give me an idea how to check a
creation date it would be appreciated.

def delete_old_files  (t:\dm\~\users)
        # find files and delete files created more than XX number of days
        update_exist = 0
        input_dir = t:\dm\~\users\xxxx.yyyyyy\zzzz
        if os.path.exists (input_dir) :
            files = os.listdir (input_dir)
            print "Unable to find input file dir: %s !!!" % input_dir
        if len(files):
            for file in files :
                file = os.path.join(input_dir) #all files in output
directory will be csv or xls, can be deleted if old enough               
                if os.path.isfile(file):   #need to check ext not file, file
name changes each day
                    if\dm\~\users\xxxxx\) and  #creation date
gt x number of days ago 

                        file_delete = 1
        if file_delete:

            print "\n file deleted: \n%s" %
        return file_delete 

Dave Fickbohm
Data Mining Analyst
1250 45th St.
Emeryville, CA, 94608
Phone 510 594 4151 - Voice
          510 655 0848 - Fax

More information about the Python-list mailing list