[zsh] add over-engeneered renumbering function
This commit is contained in:
parent
1ad2a58aac
commit
f1a2256c85
|
@ -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/")
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue