make a batch move to a place to orient photos

This commit is contained in:
Tykayn 2024-02-10 12:38:38 +01:00 committed by tykayn
parent 34522094c0
commit 9e853e0b6e
3 changed files with 47 additions and 2 deletions

View File

@ -25,8 +25,14 @@ function batch_exif_photos {
for i in $(seq $min $max); do for i in $(seq $min $max); do
filename=$i filename=$i
filename_with_zero="0$i"
file="$dir/GF$filename.JPG" file="$dir/GF$filename.JPG"
file_assemblage="/home/poule/encrypted/stockage-syncable/photos/imageries/gopro/hugin_assemblages_script_output/assemblage_0$i.jpg" file_with_zero="$dir/GF$filename_with_zero.JPG"
file_assemblage="/home/poule/encrypted/stockage-syncable/photos/imageries/gopro/hugin_assemblages_script_output/assemblage_$i.jpg"
file_assemblage_with_zero="/home/poule/encrypted/stockage-syncable/photos/imageries/gopro/hugin_assemblages_script_output/assemblage_0$i.jpg"
if [ -f "$file" ] && [ -f "$file_assemblage" ]; then if [ -f "$file" ] && [ -f "$file_assemblage" ]; then
echo "set the tags in assemblage $i from GF$filename.jpg" echo "set the tags in assemblage $i from GF$filename.jpg"
@ -35,6 +41,15 @@ function batch_exif_photos {
else else
echo "batch_exif_photos: File $file does not exist." echo "batch_exif_photos: File $file does not exist."
fi fi
# test with previous zero
if [ -f "$file_with_zero" ] && [ -f "$file_assemblage_with_zero" ]; then
echo "set the tags in assemblage $i from GF$filename_with_zero.jpg"
exiftool -tagsFromFile "$file_with_zero" $file_with_zero $file_assemblage_with_zero -overwrite_original
echo "updated the exift tags of $file_assemblage_with_zero"
else
echo "batch_exif_photos: File $file_with_zero does not exist."
fi
done done
echo "# fin des assemblages exif" echo "# fin des assemblages exif"

View File

@ -35,7 +35,7 @@ if (mini_arguments['addExifToolInScript']) {
addExifToolInScript = mini_arguments['addExifToolInScript'] addExifToolInScript = mini_arguments['addExifToolInScript']
} }
if (mini_arguments['previous_zero']) { if (mini_arguments['previous_zero']) {
previous_zero = mini_arguments['previous_zero'] previous_zero = '0'
} }
if (mini_arguments['goproMin']) { if (mini_arguments['goproMin']) {
goproMin = mini_arguments['goproMin'] goproMin = mini_arguments['goproMin']

View File

@ -0,0 +1,30 @@
#!/bin/bash
# déplacer en masse des photos assemblées dans le dossier /home/poule/encrypted/stockage-syncable/photos/imageries/gopro/A_ORIENTER
# Argument validation
if [ "$#" -ne 2 ]; then
echo "Usage: $0 <start_number> <end_number>"
exit 1
fi
start_num="$1"
end_num="$2"
src_base_name="assemblage_"
new_folder="from_$start_num"
# Créer un nouveau dossier dans dst_dir
dst_dir="/home/poule/encrypted/stockage-syncable/photos/imageries/gopro/A_ORIENTER/${new_folder}_to_$(printf '%03d\n' "$end_num")"
mkdir -p "${dst_dir}"
# Déplacer des fichiers depuis le répertoire actuel vers le nouveau dossier
for i in $(seq -f "%03g" ${start_num} ${end_num}); do
src_file="${src_base_name}${i}.jpg"
dst_file="${dst_dir}/${src_file}"
if [ -f "/home/poule/encrypted/stockage-syncable/photos/imageries/gopro/hugin_assemblages_script_output/${src_file}" ]; then
mv -- "/home/poule/encrypted/stockage-syncable/photos/imageries/gopro/hugin_assemblages_script_output/${src_file}" "${dst_file}"
echo "Déplacé ${src_file} -> ${dst_file}"
else
echo "Fichier '${src_file}' introuvable."
fi
done