title Discussion #916 Message: 2011-09-04 07.28.33 strick user strick ip 75.144.20.97 vol 1 $ cat /usr/local/bin/a /pre( #!/bin/bash cd $HOME/Downloads DIR="$1" mkdir -p "$DIR" case $# in 1) ls *.mp4 *.flv *.mp4.crdownload *.flv.crdownload *.mp4.part *.flv.part 2>/dev/null | while read f ; do test -f "$f" && test -s "$f" || continue case "$f" in *.crdownload ) g=$(basename "$f" .crdownload) test -f ",$g," && continue bash "$0" "$DIR" "$f" & echo ::::: $! ::::: "$DIR" ::::: "$f" >&2 ;; *.part ) g=$(basename "$f" .part) test -f ",$g," && continue bash "$0" "$DIR" "$f" & echo ::::: $! ::::: "$DIR" ::::: "$f" >&2 ;; * ) mv -v "$f" "$DIR" ;; esac done ;; 2) f="$2" g=$(basename "$f" .crdownload) g=$(basename "$g" .part) ln "$f" ",$g," while true ; do if test -f "$g" && test -s "$g"; then echo " $$ @@@" >&2 mv -v "$g" "$DIR" rm ",$g," break fi sleep 1 done ;; *) echo WTF: $* >&2 exit 13 ;; esac /pre)