#!/bin/bash # Checks to make sure all videos off of phone have been copied to the Originals directory # If they are missing, it means Nextcloud missed them somehow. Copy them to New Memories then. dcim_path="/storage/emulated/0/DCIM/Camera" originals="/naspool/dropbox/Originals" new_memories="/naspool/dropbox/New Memories" adb connect 192.168.0.23 if [[ $? != 0 ]]; then echo "#ERROR: Unable to connect to phone at 192.168.0.23" exit 1 fi mp4s_on_phone=$(adb -e shell ls -1 $dcim_path/*.mp4 | xargs -n 1 basename) mp4s_in_originals=$(/bin/ls -1 $originals/*.mp4 | xargs -n 1 basename) for i in $mp4s_on_phone; do echo "$mp4s_in_originals" | grep -q $i if [[ $? == 1 ]]; then echo "mp4 not found in originals: $i" adb -e pull "$dcim_path/$i" "$new_memories" fi done