#! /bin/zsh # # this file: # https://dataswamp.org/~incal/conf/.zsh/files-rename enum-names () { local fs=($@) local num=0 local name local ext for f in $fs; do ext=${f:e:l} num=$(( $num + 1 )) name=${(l:2::0:)num}.${ext} mv $f $name done } change-ext () { local ext=$1 shift local fs=($@) for f in $fs; do if [[ -f $f ]]; then mv $f ${f:r}.${ext} else no-file-msg $f fi done }