|
@@ -25,33 +25,35 @@ fi
|
|
|
SAVEIFS=$IFS
|
|
|
IFS=$(echo -en "\n\b")
|
|
|
|
|
|
-if compgen -G "${MIDJOURNEYDIR}/images/*.png" > /dev/null; then
|
|
|
- echo New files. Sorting. 2>&1 | tee -a ${LOGFILE}
|
|
|
- for i in ${MIDJOURNEYDIR}/images/*.png; do
|
|
|
- maxdim=$(file "$i" | awk '{ print ($6 > $8)? $6 : $8 }' | sed 's/,$//')
|
|
|
- if [ $maxdim -lt 1024 ]; then
|
|
|
- echo SMALL: "$i" 2>&1 | tee -a ${LOGFILE}
|
|
|
- rsync $i ${MIDJOURNEYDIR}/images.small/ 2>&1 | tee -a ${LOGFILE}
|
|
|
- if [ $? -eq 0 ]; then
|
|
|
- mv $i ${MIDJOURNEYDIR}/images.filtered/ 2>&1 | tee -a ${LOGFILE}
|
|
|
+(
|
|
|
+ if compgen -G "${MIDJOURNEYDIR}/images/*.png" > /dev/null; then
|
|
|
+ echo New files. Sorting.
|
|
|
+ for i in ${MIDJOURNEYDIR}/images/*.png; do
|
|
|
+ maxdim=$(file "$i" | awk '{ print ($6 > $8)? $6 : $8 }' | sed 's/,$//')
|
|
|
+ if [ $maxdim -lt 1024 ]; then
|
|
|
+ echo SMALL: "$i"
|
|
|
+ rsync $i ${MIDJOURNEYDIR}/images.small/
|
|
|
+ if [ $? -eq 0 ]; then
|
|
|
+ mv $i ${MIDJOURNEYDIR}/images.filtered/
|
|
|
+ fi
|
|
|
+ elif [ $maxdim -lt 1281 ]; then
|
|
|
+ echo MEDIUM: "$i"
|
|
|
+ rsync $i ${MIDJOURNEYDIR}/images.medium/
|
|
|
+ if [ $? -eq 0 ]; then
|
|
|
+ mv $i ${MIDJOURNEYDIR}/images.filtered/
|
|
|
+ fi
|
|
|
+ else
|
|
|
+ echo LARGE: "$i"
|
|
|
+ rsync $i ${MIDJOURNEYDIR}/images.large/
|
|
|
+ if [ $? -eq 0 ]; then
|
|
|
+ mv $i ${MIDJOURNEYDIR}/images.filtered/
|
|
|
+ fi
|
|
|
fi
|
|
|
- elif [ $maxdim -lt 1281 ]; then
|
|
|
- echo MEDIUM: "$i" 2>&1 | tee -a ${LOGFILE}
|
|
|
- rsync $i ${MIDJOURNEYDIR}/images.medium/ 2>&1 | tee -a ${LOGFILE}
|
|
|
- if [ $? -eq 0 ]; then
|
|
|
- mv $i ${MIDJOURNEYDIR}/images.filtered/ 2>&1 | tee -a ${LOGFILE}
|
|
|
- fi
|
|
|
- else
|
|
|
- echo LARGE: "$i" 2>&1 | tee -a ${LOGFILE}
|
|
|
- rsync $i ${MIDJOURNEYDIR}/images.large/ 2>&1 | tee -a ${LOGFILE}
|
|
|
- if [ $? -eq 0 ]; then
|
|
|
- mv $i ${MIDJOURNEYDIR}/images.filtered/ 2>&1 | tee -a ${LOGFILE}
|
|
|
- fi
|
|
|
- fi
|
|
|
- done
|
|
|
-else
|
|
|
- echo No new files. No need to sort. 2>&1 | tee -a ${LOGFILE}
|
|
|
-fi
|
|
|
+ done
|
|
|
+ else
|
|
|
+ echo No new files. No need to sort.
|
|
|
+ fi
|
|
|
+) 2>&1 | tee -a ${LOGFILE}
|
|
|
|
|
|
echo Syncing Small 2>&1 | tee -a ${LOGFILE}
|
|
|
${GDRIVE} sync upload --keep-largest ${MIDJOURNEYDIR}/images.small/ $SMALL 2>&1 | tee -a ${LOGFILE}
|