[zsh] add over-engeneered renumbering function

legacy
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
1 changed files with 14 additions and 0 deletions

View File

@ -104,6 +104,20 @@ function urlencode() {
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() {
mkvextract $1 attachments $(mkvmerge --identify $1|grep "Attachment ID"|sed "s/Attachment ID \([0-9]*\): .*/\1/")
}