]> git.scottworley.com Git - picsort/blame - slurp-pics
Say if a picture is deleted
[picsort] / slurp-pics
CommitLineData
89e9c6b7
SW
1#!/bin/bash
2
3while read host path;do
348610a4 4 outdir="slurp-$host"
20f5e5b6 5 seendir="slurp-seen"
89e9c6b7 6 {
20f5e5b6 7 mkdir -p "$outdir" "$seendir/$outdir"
89e9c6b7
SW
8 echo "cd $path"
9 sftp -v -P 19362 -i .slurp-key "slurp@$host" <<< "cd $path"$'\n'"ls -1" |
10 sed 1,2d |
11 while read filename;do
348610a4 12 output_filename="$outdir/${filename/jpg/jpeg}"
20f5e5b6 13 if [[ -e "$output_filename" || -e "$seendir/$output_filename" ]];then
89e9c6b7
SW
14 echo "skipping $filename" >&2
15 else
16 echo "getting $filename" >&2
348610a4 17 echo "get -p $filename $output_filename"
89e9c6b7
SW
18 fi
19 done
20 } | sftp -v -P 19362 -i .slurp-key "slurp@$host"
20f5e5b6
SW
21 for f in "$outdir"/*;do
22 touch "$seendir/$f"
23 done
24 rename-to-date "$outdir"/*
89e9c6b7 25done < .slurp-hosts