]> git.scottworley.com Git - picsort/commitdiff
Automate fetching from remote hosts
authorScott Worley <scottworley@scottworley.com>
Sun, 6 Apr 2014 07:06:01 +0000 (00:06 -0700)
committerScott Worley <scottworley@scottworley.com>
Sun, 6 Apr 2014 07:06:01 +0000 (00:06 -0700)
Do an already-exists check instead of just using rsync because some
impoverished hosts like Android phones that don't have rsync.

I'm using this with
https://play.google.com/store/apps/details?id=com.icecoldapps.sshserver

.gitignore
slurp-pics [new file with mode: 0755]

index d022e9d8313b3c51d4cb39fd1a546c1b2f63c622..c2a9d3890c5ce57c9379d72e1c48b4fc3ecb03da 100644 (file)
@@ -1,4 +1,8 @@
 ??
 *\.jpeg
 *\.NEF
 ??
 *\.jpeg
 *\.NEF
+*\.mp4
 \.default-pic-mv-destdir
 \.default-pic-mv-destdir
+\.slurp-hosts
+\.slurp-key
+\.slurp-key\.pub
diff --git a/slurp-pics b/slurp-pics
new file mode 100755 (executable)
index 0000000..7c90ed8
--- /dev/null
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+while read host path;do
+  {
+    echo "cd $path"
+    sftp -v -P 19362 -i .slurp-key "slurp@$host" <<< "cd $path"$'\n'"ls -1" |
+      sed 1,2d |
+      while read filename;do
+        if [[ -e "$filename" ]];then
+          echo "skipping $filename" >&2
+        else
+          echo "getting $filename" >&2
+          echo "get -p $filename ${filename/jpg/jpeg}"
+        fi
+      done
+   } | sftp -v -P 19362 -i .slurp-key "slurp@$host"
+done < .slurp-hosts