#!/bin/bash

#DIR="/data/decalog_images/numerisation_fonds_patrimoniaux"
#DIR="/data/decalog_images/numerisation_multimedias"
DIR="/data/decalog_images/numerisation_maciet"

SAVEIFS=$IFS
IFS=$'\n'
#for rep in $(ls -C1 "$DIR");do

for rep in $(for dossier in $(find $DIR/ -type d -name "LEC");do test -d $dossier/zoomify;if [ $? -eq 1 ];then echo $dossier;fi;done);do
	#for sousrep in $(ls -C1 $DIR/$rep);do


	#TODO : supprimer automatiquement les vielles images générées

 	sed -i 's|^imagesPath = .*|imagesPath = \"'$rep'\"|' /data/traitementImages/config/clients_import.ini
	echo "Traitement de $rep"
	php /data/traitementImages/gatewayImages_import.php 3241918421119432342 thumb
	php /data/traitementImages/gatewayImages_import.php 3241918421119432342 thumbGallery
	php /data/traitementImages/gatewayImages_import.php 3241918421119432342 zoomify
	sleep 3
done


IFS=$SAVEIFS
