Hello everyone,
How can I check in Python if a FGDB exists?
Thanks
arcpy.Exists(r"C:\Path\To\fgdb.gdb")
Will check if it exists, but not if it is a valid geodatabase. If you have an empty folder with a .gdb extension, it will still return True. So, depending on your needs this may or may not be what you want.
Exactly. And if you want to exclude other types of workspace, you could check the workspaceType property of the describe object, or even workspaceFactoryProgID.
So if you also want to make sure it is a valid fgdb, look at arcpy.Describe("path/to/f.gdb") and check its dataType
== "Workspace"
Have you tried using arcpy.Exists?
ArcGIS Help (10.2, 10.2.1, and 10.2.2)
From the help
Determines the existence of the specified data object. Tests for the existence of feature classes, tables, datasets, shapefiles, workspaces, layers, and files in the current workspace. The function returns a Boolean indicating if the element exists.
Les membres connectés peuvent publier, suivre les mises à jour, et plus encore. Nouveau ici ? Inscrivez-vous gratuitement.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.