If you’re confident that all of the MXDs you want to address are in the form subdirectory/document.mxd, then the glob module should work to give you a list based on the string path + "/*/*.mxd" You could append this to path + "/*.mxd" to address all of the files of interest in one list. -- Andy On May 29, 2014, at 8:12 AM, Michael Lachance wrote: Hi All, I have been working with Python quite a bit more since the Spring NeArc meeting but I'm still pretty new to it and had a question. I'm wondering how I can get a script to run not only on files in a folder, but also files in subdirectories within that folder. The script I put together goes into each MXD in the folder I specifiy and re-sources one of our files that has been renamed. It works, but I have MXDs saved in subdirectories and it would be so much easier to have the script run on the main folder "MXDs" rather than have to specify a new subdirectory everytime I want to run it on a set of MXDs. Is this possible? My research suggests a walk function [os.walk()] or using the glob module? Here is the code I have been using. Feel free to give any feedback on it as I am still a rookie with Python: import arcpy, os path = r"I:/ARC/DATA/MXDs/Weekly Report" for fileName in os.listdir(path): fullPath = os.path.join(path, fileName) if os.path.isfile(fullPath): basename, extension = os.path.splitext(fullPath) if extension == ".mxd": mxd = arcpy.mapping.MapDocument(fullPath) print "MXD: " + fullPath for df in arcpy.mapping.ListDataFrames(mxd): for lyr in arcpy.mapping.ListLayers(mxd,"",df): findthis = 'Positive Trees' findthat = 'Infested Trees' if findthis in lyr.name<http://lyr.name/> or findthat in lyr.name<http://lyr.name/>: lyr.replaceDataSource(r'I:/ARC/Data/InfestedTrees/Infested_trees.gdb','FILEGDB_WORKSPACE','Trees') print(lyr.name<http://lyr.name/> + " - Layer Resourced to Infested Trees") else: pass arcpy.RefreshTOC() arcpy.RefreshActiveView() mxd.save() print "--Script complete--" Thanks! -- Michael Lachance