Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
more fun with parameter expansion
- X-seq: zsh-users 3173
- From: Clint Adams <schizo@xxxxxxxxxx>
- To: zsh-users@xxxxxxxxxxxxxx
- Subject: more fun with parameter expansion
- Date: Fri, 16 Jun 2000 14:53:30 -0400
- Mailing-list: contact zsh-users-help@xxxxxxxxxxxxxx; run by ezmlm
This is for someone who wants to take a directory tree and convert all
the filenames (and directory names) to lowercase, replacing spaces
with underscores. It presumes that you are using GNU mv and have
MARK_DIRS set. I'm sure that someone can make it more efficient.
for i (*(/N)) {mv -v "$i" "${(L)i:gs/ /_/}"}
for i (*/**/*(/N)) {mv -v "${${(L)i%/*/}:gs/ /_/}/${${${i#*/}%/}##*/}" "${(L)i:gfor i (**/*(N^/)) {mv -v "${i}" "${(L)i:gs/ /_/}"}
Messages sorted by:
Reverse Date,
Date,
Thread,
Author