[zsh] add over-engeneered renumbering function

This commit is contained in:
Simon Bruder 2019-06-22 17:27:53 +00:00
parent 1ad2a58aac
commit f1a2256c85
No known key found for this signature in database
GPG key ID: 6F03E0000CC5B62F

View file

@ -104,6 +104,20 @@ function urlencode() {
python3 -c "import urllib.parse; print(urllib.parse.quote(open(0, 'rb').read()))" python3 -c "import urllib.parse; print(urllib.parse.quote(open(0, 'rb').read()))"
} }
function renumber() (
if (( $# < 2 )); then
echo "USAGE: $0 DIGITS FILES"
return 1
fi
digits=$1
shift 1
i=1
for file in $@; do
mv "$file" "$(dirname $file)/$(printf %0${digits}d $i).${file##*.}"
i=$((i+1))
done
)
function mkvextract-all-attachments() { function mkvextract-all-attachments() {
mkvextract $1 attachments $(mkvmerge --identify $1|grep "Attachment ID"|sed "s/Attachment ID \([0-9]*\): .*/\1/") mkvextract $1 attachments $(mkvmerge --identify $1|grep "Attachment ID"|sed "s/Attachment ID \([0-9]*\): .*/\1/")
} }