]> Sergey Matveev's repositories - feeder.git/blobdiff - cmd/download-encs.zsh
encs/warcs destination is optional
[feeder.git] / cmd / download-encs.zsh
index 9e62ffd16b4adb398d962a66fe8eb9b65980d544..81ac0a6c44b6fd6d8d9a8ea5a330a2c00449d1a7 100755 (executable)
@@ -3,6 +3,8 @@ set -e
 fpath=($0:h:a/functions.zsh $fpath)
 dst=$2:a
 cd $1
+[[ -n "$dst" ]] || { dst=encs ; dst=$dst:a }
+mkdir -p $dst
 autoload url-to-filename
 zmodload -F zsh/datetime b:strftime
 setopt EXTENDED_GLOB
@@ -14,7 +16,7 @@ for new (new/*(N)) {
         url=$cols[2]
         [[ -n "$url" ]]
         fn=$(url-to-filename $url)-$(strftime %Y%m%d-%H%M%S)
-        wget --output-file=enc.log --output-document=$dst/$fn $url
-        print $fn
+        wget --output-document=$dst/$fn $url 2>&2 2>enc.log
+        print $dst/$fn
     done < $new
 }