incremental pull of new media files master
authorDobrica Pavlinusic <dpavlin@rot13.org>
Tue, 8 Jul 2014 11:54:47 +0000 (13:54 +0200)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Tue, 8 Jul 2014 11:54:47 +0000 (13:54 +0200)
adb-dcim.sh

index 07ef4b4..426fc05 100755 (executable)
@@ -1,4 +1,10 @@
 #!/bin/sh -x
 
-mkdir /tmp/DCIM
-adb pull /sdcard/DCIM /tmp/DCIM/
+sdcard=/sdcard/DCIM/Camera/
+to=/data/DCIM/Camera/
+
+adb shell find $sdcard -mindepth 1 -maxdepth 1 | sed "s!$sdcard/*!!" | tr -d '\r' | sort > /tmp/dcim.android
+test -d $to || mkdir $to
+find $to -mindepth 1 -maxdepth 1 | sed "s!$to!!" | sort > /tmp/dcim.disk
+diff -uw /tmp/dcim.android /tmp/dcim.disk | grep -- "^-" | sed 's/^-//' | \
+xargs -i sh -xc "adb pull $sdcard/{} $to/{}"