#!/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.
+# 1) First connect the phone to a computer with USB debugging turned on.
+# Authorize the connection
+# 2) Execute the command "adb tcpip 5555"
+# 3) Run the script, authorize the connection
+# 4) Run the script again
+# You should now be able to connect to the device wirelessly
dcim_path="/storage/emulated/0/DCIM/Camera"
originals="/naspool/dropbox/Originals"
+organized_logs="/var/log/organize"
new_memories="/naspool/dropbox/New Memories"
adb connect 192.168.0.23
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
+ if [[ $? != 0 ]]; then
+ zgrep -q $i $organized_logs/organize_videos*
+ if [[ $? != 0 ]]; then
+ echo "mp4 not found in originals or organize logs: $i"
+ if [[ ! -e "$new_memories/$i" ]]; then
+ adb -e pull "$dcim_path/$i" "$new_memories"
+ else
+ echo "mp4 already copied into $new_memories"
+ fi
+ else
+ echo "mp4 found in originals or organize logs: $i"
+ fi
+ else
+ echo "mp4 found in originals or organize logs: $i"
+ fi
done