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