Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: changing file names 'on the fly'
- X-seq: zsh-users 14316
- From: zzapper <david@xxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: changing file names 'on the fly'
- Date: Tue, 25 Aug 2009 12:53:22 +0000 (UTC)
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- Organization: SuccessTheory
- References: <h6osb5$b38$1@xxxxxxxxxxxxx> <20090822134435.GZ19496@xxxxxxxxxxxxxxx>
- Sender: news <news@xxxxxxxxxxxxx>
Hi
May be a job for zmv ....
# zmv "programmable rename"
autoload -U zmv
# Replace spaces in filenames with a underline
zmv '* *' '$f:gs/ /_'
zmv '(* *)' '${1// /}'
zmv -Q "(**/)(* *)(D)" "\$1\${2// /_}"
# Change the suffix from *.sh to *.pl
zmv -W '*.sh' '*.pl'
# lowercase/uppercase all files/directories
$ zmv '(*)' '${(L)1}' # lowercase
$ zmv '(*)' '${(U)1}' # uppercase
--
zzapper
http://www.successtheory.com/tips/zshtips.html
Messages sorted by:
Reverse Date,
Date,
Thread,
Author