BrokenLegMike

Cross Referencing Files and Counting

Discussion created by BrokenLegMike on Jun 20, 2011
Latest reply on Jun 20, 2011 by BrokenLegMike
Hey folks,

I am attempting to cross reference a folder containing jpg's with a field in a point feature class that contains a text string with the associated jpg file name. After which, it will copy the matching jpg's into a second directory.

My script runs fine, but I want to do a count on the number of jpg's returned from the match. I've tried a variety of codes to make this happen, and so far the best I've got is below. The problem is, the counter is outputting 1 all the time. I want it to make an accumulated count. Any suggestions?

Thanks,
Mike

    for raster in rasterList:

        root, exten = os.path.splitext(raster)

        # Create SearchCursor for feature class.
        rows = arcpy.SearchCursor("fc")
        counter = 0
        for row in rows:

            if row.PHOTOS != "N/A":
                rowphotos = row.PHOTOS

                if root.lower() == rowphotos.lower():
                    rootext = root + exten
                    counter += 1
                    print counter

                    if rootext == raster:
                                                         
                        print rowphotos + " " + root
                        shutil.copy2(source + rootext, "Z:\ESRI\Figure_Sourcing\Figures\Access Photos\Copied")
                       


Outcomes