I need to access the date of creation of a file using Python.
As suggested in many posts, I am using
import os, time
f = 'untitled.ipynb' # Created 30 March 2016 at 15:45
fileStats = os.stat(f)
'Mon May 2 16:04:27 2016'
"Created: 30 March 2016 at 15:45"
accordint to the documentation at https://docs.python.org/2/library/os.html:
since you are using OSX, what you need is
st_birthtime instead of
st_ctime- platform dependent; time of most recent metadata change on Unix, or the time of creation on Windows.
On other Unix systems (such as FreeBSD), the following attributes may be available (but may be only filled out if root tries to use them):
st_birthtime- time of file creation