Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

enum-files and change-ext



Hello, I just wrote this. [1]

Is it any good? :)

TIA


enumerate-files () {
    local -a files
    files=($@)

    local number=1

    for f in $files; do
        if [[ -f $f ]]; then
            mv $f ${number}.${f:e}
            number=$(( $number + 1 ))
        else
            no-file-msg $f # http://user.it.uu.se/~embe8573/conf/.zsh/error
        fi
    done
}
alias enum-files=enumerate-files

change-extention () {
    local new_extention=$1
    shift

    local -a files
    files=($@)

    for f in $files; do
        if [[ -f $f ]]; then
            mv $f ${f:r}.$new_extention
        else
            no-file-msg $f
        fi
    done
}
alias change-ext=change-extention


[1] lines 11-42 @ http://user.it.uu.se/~embe8573/conf/.zsh/files-fs

-- 
underground experts united
http://user.it.uu.se/~embe8573



Messages sorted by: Reverse Date, Date, Thread, Author