I have 200+ directories, each directory contains x amount of TIFFs which I want to mosaic.
I have a snip of code that will list the TIFF contents of all dirs under a parent directory, now I just need to parse the list (per dir), pass it to the mosaic program and run all TIFFs in the first dir, then loop to the next dir in the list and repeat the mosaic operation.
import arcpy
import os
#Set the workspace enviorment setting
arcpy.env.workspace = r"C:/Work/SpaceNet/Test2"
walk = arcpy.da.Walk(datatype="RasterDataset")
for dir_path, dir_names, file_names in walk:
for filename in file_names:
print(os.path.join(dir_path, filename))
Returns (from 2 dirs in this example, 00114 and 00628):
C:\Work\SpaceNet\Test2\00114 SN6_Train_AOI_11_Rotterdam_SAR-Intensity_20190822100114_20190822100413_tile_678.tif
C:\Work\SpaceNet\Test2\00114 SN6_Train_AOI_11_Rotterdam_SAR-Intensity_20190822100114_20190822100413_tile_679.tif
C:\Work\SpaceNet\Test2\00114 SN6_Train_AOI_11_Rotterdam_SAR-Intensity_20190822100114_20190822100413_tile_680.tif
C:\Work\SpaceNet\Test2\00628 SN6_Train_AOI_11_Rotterdam_SAR-Intensity_20190823100628_20190823100943_tile_5430.tif
C:\Work\SpaceNet\Test2\00628 SN6_Train_AOI_11_Rotterdam_SAR-Intensity_20190823100628_20190823100943_tile_5431.tif
C:\Work\SpaceNet\Test2\00628 SN6_Train_AOI_11_Rotterdam_SAR-Intensity_20190823100628_20190823100943_tile_5432.tif