]> git.scottworley.com Git - picsort/blob - slurp-pics
Keep files under two names
[picsort] / slurp-pics
1 #!/bin/bash
2
3 while read host path;do
4 outdir="slurp-$host"
5 {
6 mkdir -p "$outdir"
7 echo "cd $path"
8 sftp -v -P 19362 -i .slurp-key "slurp@$host" <<< "cd $path"$'\n'"ls -1" |
9 sed 1,2d |
10 while read filename;do
11 output_filename="$outdir/${filename/jpg/jpeg}"
12 if [[ -e "$output_filename" ]];then
13 echo "skipping $filename" >&2
14 else
15 echo "getting $filename" >&2
16 echo "get -p $filename $output_filename"
17 fi
18 done
19 } | sftp -v -P 19362 -i .slurp-key "slurp@$host"
20 rename-to-date -l "$outdir"/*
21 done < .slurp-hosts