2

I have zero experience with python but am trying to search for broken hyperlinks in a large gdb (temporarily converted to a shapefile)-

Used code from a previous question (Using ArcPy to verify paths of Hyperlinks?) and adapted it to fit my problem (didn't know if I could ask a new question on that post...)

import arcpy
import os
fc = r"G:\GISDATA\misc\project_arcpy.shp"
fields = ["PROJECT_DW"]
with arcpy.da.SearchCursor (fc,fields) as cursor:
for row in cursor:
 Roll = str(row[0])
 if os.path.exists(Roll):
 pass
 else:
 f = open(r"C:\Users\GIS\Documents\brokenlinks.txt","a")
 f.write(Roll + os.linesep)
 f.close()

Instead of writing broken hyperlinks to my text file, it writes all they hyperlinks to the file.

asked Mar 6, 2014 at 15:00
7
  • Could you provide more details on what defines a broken hyperlink? Commented Mar 6, 2014 at 16:54
  • 2
    What version of ArcGIS for Desktop are you using? Either way I think the key will be to use a Search Cursor to look up where the Hyperlink field is pointing and then use arcpy.Exists() to see if that location exists. Commented Mar 7, 2014 at 8:39
  • Broken hyperlink= hyprelink won't work anymore because the name was changed by a coworker or the document no longer exists. Commented Mar 7, 2014 at 16:13
  • PolyGeo=using arcgis 10.1. OK, thanks...I will try to put that into code.. Commented Mar 7, 2014 at 16:13
  • @Tracy: Is the field "PROJECT_DW" contains web link or network/local disk path or both? Commented May 8, 2014 at 21:54

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.