Hello Laurent,
I could suggest something like the following. The script should look for all folders in "../2 - PHOTOS/" directory, create the separate project for each of such folders, fill the project chunk with the photos from the folder and save the project to "/1 - PHOTOSCAN/4 - Projects/" directory.
import PhotoScan, os
doc = PhotoScan.app.document
# Choix des chemins
Path_Photos = "D://1 - PFE_BITARD_PSM/Blocs_Photoscan/Gros_blocs/2 - PHOTOS/"
Path_Project = "D://1 - PFE_BITARD_PSM/Blocs_Photoscan/Gros_blocs/1 - PHOTOSCAN/4 - Projects/"
folders_list = os.listdir(Path_Photos)
for folder in folders_list:
if os.path.isdir(folders_list + folder):
new_doc = PhotoScan.Document()
new_doc.save(Path_Project + folder + ".psz")
image_list = os.listdir(Path_Photos + folder)
photo_list = list()
for photo in image_list:
if photo.rsplit(".",1)[1].upper() in ["JPG", "JPEG", "TIF", "TIFF", "PNG"]:
photo_list.append(path_photos + folder + "/" + photo)
# print(photo)
else:
print("as de photo exploitable dans le dossier.")
print(photo_list)
chunk = new_doc.addChunk()
chunk.addPhotos(photo_list)
new_doc.save()
print("document saved to " + Path_Project + folder + ".psz")
print("finished")