27 lines
538 B
Bash
Executable File
27 lines
538 B
Bash
Executable File
#!/bin/bash
|
|
|
|
. qolop
|
|
|
|
_help() {
|
|
_qCol G
|
|
echo "Interactive rename"
|
|
_qCol W
|
|
echo "The alternative version stored as mvregex-q"
|
|
_qCol Z
|
|
rename --help | sed /^$/d
|
|
exit
|
|
}
|
|
|
|
if [[ -z "$1" ]]; then _help; fi;
|
|
for (( i=1; i<=$#; i++ )); do
|
|
[[ ${!i} = "--help" ]] && { _help; }
|
|
[[ ${!i} = "-h" ]] && { _help; }
|
|
done
|
|
if [[ -z "$2" ]]; then files="*"; fi
|
|
set -e -o pipefail
|
|
rename -n "$@" $files | sed -e 's/^rename(//' -e 's/)$//' -e 's/, / -> /'
|
|
_qCol G
|
|
read -p "OK? " ok
|
|
_qCol Z
|
|
rename -v "$@" $files | sed -e 's/renamed as/=>/'
|