From 89e9c6b74e84efeeb74e543c829eb93fa61df993 Mon Sep 17 00:00:00 2001 From: Scott Worley Date: Sun, 6 Apr 2014 00:06:01 -0700 Subject: [PATCH 1/1] Automate fetching from remote hosts 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 | 4 ++++ slurp-pics | 17 +++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100755 slurp-pics diff --git a/.gitignore b/.gitignore index d022e9d..c2a9d38 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,8 @@ ?? *\.jpeg *\.NEF +*\.mp4 \.default-pic-mv-destdir +\.slurp-hosts +\.slurp-key +\.slurp-key\.pub diff --git a/slurp-pics b/slurp-pics new file mode 100755 index 0000000..7c90ed8 --- /dev/null +++ b/slurp-pics @@ -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 -- 2.44.1