defextractSingleBand(multiBandImgPath,singleBandSavePath): f_list = os.listdir(multiBandImgPath) for file in f_list: if os.path.splitext(file)[1] == ".tif": tif = str(multiBandImgPath) + "\\" + str(file) arcpy.env.workspace = tif for raster in arcpy.ListRasters(): #The name of band to extract if str(raster) == "bandName": bandrasteroutputname = singleBandSavePath+"bandName" + file arcpy.CopyRaster_management(raster, bandrasteroutputname, "", -999, -999) print"done"