Loop through folder of JPGS and copy their names to a geodatabase table

624
2
Jump to solution
05-04-2020 01:42 PM
CarverCounty
New Contributor II
import arcpy
import os

table = r'the location to the geodatabase table I wish to populate'

arcpy.env.workspace = r'the folder path to my jpgs'
for jpeg in arcpy.ListFiles("*.jpg"):
   output = os.path.splitext(jpeg)[0]
   print ouput
arcpy.CopyRows_management(output, table)‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

Hello,

I am trying to loop through a folder that contains 500+ JPGs and copy their names to a geodatabase table.  I am able to successfully get to line 9 in my example code above and print all of my JPG names. However, when I get to line 10, I am unable to successfully copy these names to a new geodatabase table.  Would anyone have any suggestions?

Thanks in advance,

Craig 

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
JoeBorgione
MVP Emeritus

Take a look at  insert cursor.  

That should just about do it....

View solution in original post

2 Replies
JoeBorgione
MVP Emeritus

Take a look at  insert cursor.  

That should just about do it....
CarverCounty
New Contributor II

That did the trick.  Thanks Joe!