Selecting files from multiple folders

Discussion created by justgis on May 16, 2012
Latest reply on May 16, 2012 by justgis
I haven't played in Python for almost two years so I'm very rusty. I'm definitely not saying I was all that good at it then. I could use some help with this.
I have a folder, that contains many folders, and each of those folders have a file I need to grab and put it into my map. I'm going to have to do this 1000's of times so I thought a script would be nice to run. Here's what I have so far (and I got help with this too):

# Import arcpy module
import arcpy
import string
import os

# Local variables:
#Set workspace
arcpy.env.workspace = "C:\\DWG\\FOLDER\\FOLDER*"
Polyline = "\Polyline"
LineShp = "C:\\DWG\\FOLDER\\Shape\\"

# Process: Select
for i in arcpy.ListFiles ("*.dwg"):
    x = i.strip('.dwgDWG')
    fileout = LineShp + x + ".shp"
    print "Processing:" + arcpy.env.workspace + "\\" + Polyline + "To:" + fileout

It looks like its running but when I go to the folder where the .shp should be, it's empty. My print statement doesn't print anything. I'm not sure I can use a wildcard for my workspace either. Thanks for your help!