Batch Project and Copy Features - problem converting from 9.3 (arcscripting) to 10

Discussion created by Muskie77 on Jan 17, 2012

I have this following script that I am trying to test out using IDLE 2.6.5. Notably, I've had a very similar script run before using Arc 9.3...

What I'd like to do:

1) Write a script that looks into a directory, creates a list of shapefiles, and from this list batch projects all the shapefiles in the directory into a specific gdb (i.e. always to be named 'input.gdb'...there is one already existing in each directory). Output feature classes will have a specific name.

2) I would like to be able to use the script in model builder and make the directory user defined (i.e. variable folder in the below script) will be sys.argv(1). A little uncertain how to do this..but theoretically makes sense, right?

3) I am fine hard-coding the search pattern with a wildcard..."*.shp"...mostly because I doubt some of my users will know what a wildcard is...

SO far my script looks as thus:
##Convert and reporoject shapefiles from RR_Sierra_Nevada\Forests
## Import modules and create geoprocessor object

import arcpy
import os
import fnmatch
import sys
import string

# Set the workspace. List all of the shapefiles

# input workspace

arcpy.env.workspace = r"D:\RR_Sierra_Nevada"

# returns a list of shapefiles in the specified folder
# that match the specified wildcard search pattern

folder =r"D:\RR_Sierra_Nevada\Forests\Inyo"
pattern = "*.shp"
shpList = []

for path, dirs, files in os.walk(folder):
       for filename in fnmatch.filter(files, pattern):
               shpList.append(os.path.join(path, filename))

arcpy.AddMessage("Shapefiles returned:")
for shp in shpList:

print shp

The error I keep getting is EITHER a blank return...or there is no such thing as 'import arcpy' (?).

Any thoughts...