
# Import system modules
import sys
import string
import os
import win32com.client
import odbc
import shutil
from win32com.client import Dispatch
gp = win32com.client.Dispatch("esriGeoprocessing.GpDispatch.1")

gp.SetProduct("ArcInfo")
gp.workspace = "c:/mydata"

try:
    cycle = open('c:/mydata/county_cycle.txt', 'r')
    for countyid in cycle.readlines():
        # for countyid = one, two, thr
        x = countyid.rstrip()
        print x
     

        if x=='one':
            county_name = open('c:/mydata/county1.txt', 'r')
            for county in county_name.readlines():
                county = county.rstrip()
                #print county

        elif x=='two':
            county_name = open('c:/mydata/county2.txt', 'r')
            for county in county_name.readlines():
                county = county.rstrip() 
                #print county

        else:
            county_name = open('c:/mydata/county3.txt', 'r')
            for county in county_name.readlines():
                      
                county = county.rstrip() 
                #print county
                print county
                    

                gp.copy("%smydata1"%county,"%smydata2"%county) 
except Exception, ErrDesc:
    print ErrorDesc