diff --git a/photo_du_mois.sh b/photo_du_mois.sh index ed76e92..d80c400 100755 --- a/photo_du_mois.sh +++ b/photo_du_mois.sh @@ -56,10 +56,31 @@ last_remote_files() { echo -e "${bold}${server[$i]}${reset}:${dest[$i]}" if [ "${server[$i]}" == "clicclac.synology.me" ]; then - rsync -e "/usr/bin/ssh -p ${port[$i]}" --rsync-path=/bin/rsync -zarvh "${user[$i]}"@"${server[$i]}":"${dest[$i]}*" | grep -E "$last_year.jpg|$current_year.jpg" + lrf=$(rsync -e "/usr/bin/ssh -p ${port[$i]}" --rsync-path=/bin/rsync -zarvh "${user[$i]}"@"${server[$i]}":"${dest[$i]}*" | grep -E "$last_year.jpg|$current_year.jpg") else - rsync -zarvh -e "ssh -p ${port[$i]}" "${user[$i]}"@"${server[$i]}":"${dest[$i]}*" | grep -E "$last_year.jpg|$current_year.jpg" + lrf=$(rsync -zarvh -e "ssh -p ${port[$i]}" "${user[$i]}"@"${server[$i]}":"${dest[$i]}*" | grep -E "$last_year.jpg|$current_year.jpg") fi + echo "$lrf" + + l=$(echo "$lrf" | awk '{print $NF}' | awk -F"." '{print $1}') # 1_2022 + + e="" + while IFS= read -r line; do + + m=$(echo "${line}" | awk -F"_" '{printf "%02d\n", $1}') + y=$(echo "${line}" | awk -F"_" '{print $2}') + d="$y-$m-01" + ts=$(date --date="$d" +"%s") + e+="$ts\n" + + done <<< "$l" + + echo + g=$(echo -e "$e" | sort -n | sed -n '$p') + last=$(date -d "@$g" +"%B %Y") + + echo -e "More recent picture on ${server[$i]}: ${bold}$last${reset}" + echo done } @@ -77,7 +98,7 @@ echo echo -e "\n${bold}0. Verify last uploads on remote servers ${reset}\n" -#last_remote_files +last_remote_files echo -e "\n${bold}1. From Lightroom Classic, export ${italic}collection 'Photo du mois'${reset}${bold} => $SRC${reset}\n"