Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
enum-files and change-ext
- X-seq: zsh-users 23880
- From: Emanuel Berg <moasenwood@xxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: enum-files and change-ext
- Date: Sat, 23 Mar 2019 20:49:20 +0100
- Cancel-lock: sha1:N8vMQJereoQVww2nmqusS5PZF4o=
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- List-unsubscribe: <mailto:zsh-users-unsubscribe@zsh.org>
- Mail-copies-to: never
- Mail-followup-to: zsh-users@xxxxxxx
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
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