From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9056 invoked from network); 16 Jun 2000 18:54:19 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 16 Jun 2000 18:54:19 -0000 Received: (qmail 8404 invoked by alias); 16 Jun 2000 18:53:59 -0000 Mailing-List: contact zsh-users-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 3173 Received: (qmail 8395 invoked from network); 16 Jun 2000 18:53:58 -0000 Date: Fri, 16 Jun 2000 14:53:30 -0400 From: Clint Adams To: zsh-users@sunsite.auc.dk Subject: more fun with parameter expansion Message-ID: <20000616145330.A8031@scowler.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii User-Agent: Mutt/1.0.1i 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/ /_/}"}