]> git.scottworley.com Git - picsort/blame_incremental - slurp-pics
Don't re-download or re-rename-to-date seen files
[picsort] / slurp-pics
... / ...
CommitLineData
1#!/bin/bash
2
3while read host path;do
4 outdir="slurp-$host"
5 seendir="slurp-seen"
6 {
7 mkdir -p "$outdir" "$seendir/$outdir"
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
12 output_filename="$outdir/${filename/jpg/jpeg}"
13 if [[ -e "$output_filename" || -e "$seendir/$output_filename" ]];then
14 echo "skipping $filename" >&2
15 else
16 echo "getting $filename" >&2
17 echo "get -p $filename $output_filename"
18 fi
19 done
20 } | sftp -v -P 19362 -i .slurp-key "slurp@$host"
21 for f in "$outdir"/*;do
22 touch "$seendir/$f"
23 done
24 rename-to-date "$outdir"/*
25done < .slurp-hosts