List raster in multiple directories Python??

Discussion created by lyditaspm on Oct 13, 2013
Latest reply on Oct 13, 2013 by JScheirer-esristaff
I have a problem when I try to do a list raster in multiple directories. I´m beginner in python. the next script searches different files in a single directory but it not find them in several folders. Thanks!!!

import arcpy,os
from arcpy import env

path= r'H:\Python\Python\XX_pruebas'
arcpy.env.workspace =path

lstFiles = []
lstDir = os.walk(path)

for root, dirs, files in lstDir:
files =arcpy.ListRasters("*", "JPG")
for fichero in files:
(nombreFichero, extension) = os.path.splitext(fichero)
if(extension == ".jpg"):

print (lstFiles)