# Copy for Web A os.mkdir (r"C:\Work\City_Wide_Zoning\Mapbook\Mapbook\PDF\z_Grid\Test3\A") os.chdir(r"C:\Work\City_Wide_Zoning\Mapbook\Mapbook\PDF\z_Grid\Test3") for file in os.listdir('.'): if fnmatch.fnmatch(file, 'A*.pdf'): print file copy(file, r"C:\Work\City_Wide_Zoning\Mapbook\Mapbook\PDF\z_Grid\Test3\A/" + file) print 'Folder A Complete'
wild_card = "*" # for all or something like "*_pdfs" for special folders if they all subfolders in the same folder inFolders = arcpy.ListWorkspaces (wild_card, "Folder") # or: inFolders = ['folder1', 'folder2'] # manual listing the directories for inFolder in inFolders: files = arcpy.ListFiles("*.pdf") # print the filenames to check if this works. I am not sure if you get the filename with or without the complete path print files arcpy.AddMessage("%s" % files) for file in files: # file = os.path.basename(file) # if listfiles returns the complete path copy(os.path.join(inFolder, file), os.path.join(outDir, file))
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.