1

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?

  • 2
    Shapefiles and databases are VERY different things, which makes this nearly two questions. The a) and b) are also very different (though the latter is impossible) – Vince Sep 22 '15 at 18:40
  • Agree with Vince. Please clarify exactly the type of data you are asking about (and limit it to one per question). If SDE, clarify the RDBMS being used. – blah238 Sep 22 '15 at 20:10
  • Sorry, reading back my question was very unclear, my apologies. I am new at stackexchange so I appreciate your help and patience. I am trying to find the date created for shapefiles stored within a database. I am using ArcGIS, though I could export to access or another program if necessary. – Lynn O Sep 23 '15 at 19:50
1

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.

  • 1
    The dBase header has a date in it as well which would be more accurate than the file modified date (if the access utility honored the obligation to update the header). However, the .dbf timestamp only has day precision (YYMMDD) – Vince Sep 22 '15 at 19:44
  • 1
    See also GDAL ticket trac.osgeo.org/gdal/ticket/3919. GDAL has used a fixed "date of last update" value of "95-07-26" until version 2.0. The last update field of .dbf file may give some useful information but it is not especially reliable. – user30184 Sep 22 '15 at 22:00
  • thank you for your advice, I will give these suggestions a try! – Lynn O Sep 23 '15 at 19:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.