Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Created File date

Status
Not open for further replies.

KSiva

Programmer
Feb 18, 2002
63
AU
Hi,

Does any one up there knows how to get a file created date using python modules? I can only get time modified and last access time.

I really need to get the time created. Any help is appreciated!

Siva

Sivakumar Kandaraj :)
System Administrator,Web Programmer
Melbourne
Australia.
 
try the following:

[tt]import os
import time

myformat = '%A, %B %d, %Y, %I:%M:%S %p'
filestats = os.stat(yourfilehere)
loctime = time.localtime(filestats[-1])
print time.strftime(myformat, loctime)[/tt]
 
Thanks mate,

That gets me into the job! You are a legend!

Siva

Sivakumar Kandaraj :)
System Administrator,Web Programmer
Melbourne
Australia.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top