X-Git-Url: http://git.scottworley.com/picsort/blobdiff_plain/d6874f6c6a9f60aacee8cd43fd16f3e9b73b22ec..e44ce0d94e60decf487cc897cc52cb28bab9e0e7:/pic-mv diff --git a/pic-mv b/pic-mv index 23da8c3..0309ec0 100755 --- a/pic-mv +++ b/pic-mv @@ -24,8 +24,10 @@ fi file="$1" name="$2" +re_escaped_name=$(sed 's/[?+*.]/\\&/g' <<< "$name") + # Find next number -max=$(ls "$destdir" | sed -rn "s/^$name ([0-9]+).jpeg$/\1/p" | sort -n | tail -n1) +max=$(ls "$destdir" | sed -rn "s/^$re_escaped_name ([0-9]+).jpeg$/\1/p" | sort -n | tail -n1) if [[ "$max" ]];then number=$((max + 1)) else