HOW TO
Sometimes documents that must be hyperlinked to features are organized into several subfolders. This is typically done to organize large amounts of data into more manageable smaller folders. One challenge with organizing documents in this way is that it can create confusion when trying to hyperlink features to documents that could be in any of the subfolders of a primary directory. The following workflow is one method to recursively iterate through a directory to find and display documents that are associated with a feature, all through a Python script.
In this example, the primary directory is called 'Parcels', but there are several subfolders underneath, breaking the Parcels directory down by zip code. This was done to better organize the data, but can cause confusion when creating hyperlinks in ArcMap. The hyperlinked file is a .jpeg image of the front of the property, and is named by using the Parcel ID.
Code: import webbrowser, os def OpenLink([ParcelID]): for r,d,f in os.walk(r"\\serverName\Parcels"): for image in f: if image.startswith(str([ParcelID])): webbrowser.open(os.path.join(r,image)) return
Get help from ArcGIS experts
Download the Esri Support App