# checkForBrokenDataSources.py
# Input: Path to map directory
# Sample input C:\gispy\data\ch24\maps\dataSourceExample
import arcpy, os, sys

mydir = sys.argv[1]
files = os.listdir(mydir)

proprojects = [f for f in files if f.endswith('.aprx')]

for m in proprojects:
    aprx = arcpy.mp.ArcGISProject(mydir + '/' + m)
    broken = aprx.listBrokenDataSources()
    print(m)
    print(broken)
    del aprx