Using the codes mentioned here Listing feature classes in multiple geodatabases in folder using ArcPy? i was able to list all the feature_classes in multiple geodatabases within a folder. Problem is i don't know how to save the print results to a csv file. I knew, in theory - i have to create a csv file -> open it -> Append the "Print_results" to that file. Since i don't have any experience in python i don't know how to execute it.
Currently i'm trying with this code
import arcpy dir = r'D:\Test\gdb' arcpy.env.workspace = dir gdbList = arcpy.ListWorkspaces('*','FileGDB') filename = r'D:\Test\FC_List.csv with open(filename, 'wb') as myfile: wr = csv.writer(myfile,quoting=csv.QUOTE_ALL) for gdb in gdbList: arcpy.env.workspace = gdb datasetList = arcpy.ListDatasets('*','Feature') fcList = arcpy.ListFeatureClasses() for fc in fcList: print arcpy.env.workspace,fc for dataset in datasetList: arcpy.env.workspace = dataset fcList = arcpy.ListFeatureClasses() for fc in fcList: print arcpy.env.workspace,fc arcpy.env.workspace = gdb for each_fs in fcList: wr.writerow(each_fs.split(",")) print (each_fs)
I've refered to the code mentioned here https://www.snip2code.com/Snippet/163571/Write-a-list-of-personal-geodatabase-fea. Actually, this code is creating the Fc_list.csv file. But only as an empty csv file