[GIS] How to find out when a shapefile was created

arcgis-10.2arcgis-desktopenterprise-geodatabaseshapefile

I am working on a project at an agency with a large amount of prior data stored in a shared database connection .sde folder to which I have access. While this is incredibly helpful, I would like to know when these files were created so I can tell how recent/up to date the data is, in situations when the date is not noted in the properties > description for a file.

Is there a way to either (a) find out when a shapefile or database was created or (b) view a database connection folder in windows explorer?

Best Answer

For shapefiles and PGDBs only....

Using arcpy, import os and time modules to obtain date/time from the filesystem and format for collection.

Assuming FC is a featureclass:

if ".shp" in FC.lower():
            Shapefile_Date = time.strftime('%m/%d/%Y', time.gmtime(os.path.getmtime(FC)))
            statinfo = os.stat(FC)
            Shapefile_Size = statinfo.st_size
            dBaseFile = FC.replace(".shp",".dbf")
            statinfo = os.stat(dBaseFile)
            dBaseFile_Size = statinfo.st_size
            dBaseFile_Date = time.strftime('%m/%d/%Y', time.gmtime(os.path.getmtime(dBaseFile)))

Same technique will work for PGDB substituting ".mdb".

The above obtains modified time which may be more representative of usage than create time.