I'm trying to create multiple file geodatabases from a list in arcgis. When I run the script I get a box that pops up asking for a name to be input (not what I want).

How do I reference each item in the list as a name for each fDGB?

I'm fairly certain the problem is in out_name, but, since I'm a novice, there could be other issues.

My code is as follows:

import os
import sys
import arcpy

arcpy.env.workspace = "myfilepath"
arcpy.env.overwriteOutput = True

fd = []
for i in range(1980, 2101): 

out_folder_path = "myfilepath"
out_name = (".gdb" %fd)

arcpy.CreateFileGDB_management(out_folder_path, out_name, "Current")

1 Answer 1


The main issues are that you were working outside of the for loop and you were improperly concatenating strings. Try this:

import os, sys, arcpy

workspace = r'C:\path\to\your\ws'

for i in range(1980, 2101): 
    out_name = "%s.gdb" %i
    arcpy.CreateFileGDB_management(workspace, out_name)
  • 1
    Thanks a bundle Aaron, that works beautifully. +1 for you.
    – Scott W.
    Jun 8, 2017 at 22:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.