#!/bin/bash #Config file cfg="$HOME/.config/sd-script.config" if [ ! -f $cfg ]; then touch $cfg read -p "Where do you want to save your photos? [directory]: " destprompt echo "destdir='$destprompt'" >> $cfg read -p "Do you use sudo or doas?: " admin echo "doso='$admin'" >> $cfg fi source $cfg #Constant vars sd_uuid="3735-3761" mntpoint="/mnt/nikon" srcdir="$mntpoint/DCIM/100_____" #Colors GREEN="\e[32m" RED="\e[31m" YELLOW="\e[33m" ENDCOLOR="\e[0m" mkdir $mntpoint &> /dev/null if $doso mount -U $sd_uuid $mntpoint; then echo -e "[✅]$GREEN Mounted SD successfully$ENDCOLOR" else echo -e "[❌] $RED Failed to mount SD$ENDCOLOR" && exit 1; fi mkdir $destdir &> /dev/null echo -e "You have $YELLOW$(ls -l $srcdir/*.JPG | wc -l) JPG files$ENDCOLOR and $YELLOW$(ls -l $srcdir/*.NEF | wc -l) NEF files$ENDCOLOR." if rsync -rvu --ignore-existing --info=progress2 $srcdir/ $destdir/pics-$(date '+%d-%b-%Y')/; then echo -e "[✅]$GREEN Copying successful.$ENDCOLOR" else echo -e "[❌] $RED Operation failed.$ENDCOLOR" && exit 1; fi #read -p "Do you want to also send files to PC? [y/n]: " copyprompt2 #case copyprompt2 in # y|Y) echo "Continuing...";; # n|N) echo "Goodbye, Gordon.";; # *) ;; #esac #IP_Waff="192.168.0.203" #IP_Wox="192.168.0.184" #waff_dir="/media/hdd/Pictures/NikonSync" # if ping -c 1 $IP_Waff; then # echo -e "[✅]$GREEN Connection to$YELLOW Waffelo's Dragon PC$GREEN successful.$ENDCOLOR Syncing in 3 seconds..." ; sleep 3 # rsync -rvu $destdir waffelo@$IP_WAFF:$waff_dir/pics-$(date '+%d-%b-%Y')/ # else echo -e "Something went wrong. Check your PC IP." # fi