I am new to Python. I have over one hundred dbf files to merge in two diffrent workspaces.

Workspace 1: PCPT100100 PCPT101101 PCPT102101

Workspace 2: s100100 PCPT101101 s102101

I want to merge "PCPT100100 (workspace1) - s100100(workspace 2)", "PCPT101101 -PCPT101101"..... I am using the tool "append" but I don't know, how can I specify the name of the files.

I read about glob or os.walk to find files recursively.


import arcpy,glob

# Local variables:
PCPT100111_dbf = "C:\\PCPT100111.dbf"
s100110_dbf__2_ = PCPT100111_dbf

yourlist = glob.glob(r"C:\\s*.dbf)

s100110_dbf = "C:\\s100111.dbf"

# Set Geoprocessing environments
arcpy.env.workspace = "C:\\"

# Process: Append
arcpy.Append_management("'C:\\PCPT100111.dbf'", s100110_dbf, "NO_TEST", "Field1 \"Field1\" true false false 10 Long 0 10 ,First,#,C:\\PCPT100111.dbf,PRECIPITAT,-1,-1", "")

print "Append is done"

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.