#!/bin/zsh
#
# rename file (name given as arg) to
#   all lowercase, blanks replaced by dashes
#
# author: Joerg Arndt (see http://www.jjj.de )
# version: 2024-January-06 (09:23)
#

if [ $# -lt 1 ]; then
    echo 'Need one more args:  filename(s)';
    exit 1;
fi

#echo "1=[${1}]";
#echo "#=[${#}]";
#echo "*=[${*}]";
for F in ${*}; do
    X=$F;
    X=$(echo $X | tr '[A-Z]' '[a-z]');
    X=$(echo $X | tr ' ' '-');
#    echo "  F=[$F]";
#    echo "  X=[$X]";
    if [ "$F" != "$X" ] ; then
        echo "$F =--> $X";
        mv -i $F $X;
    fi
done

exit 0;

#############################


#!/bin/zsh
#

## rename ALL files to lowercase:
autoload zmv
zmv '(*)' '${(L)1}'

exit 0;

#############################

