From: Scott Worley Date: Sun, 6 Apr 2014 07:06:01 +0000 (-0700) Subject: Automate fetching from remote hosts X-Git-Url: http://git.scottworley.com/picsort/commitdiff_plain/89e9c6b74e84efeeb74e543c829eb93fa61df993 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 --- 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