Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!uunet!ateng!chip From: chip@ateng.com (Chip Salzenberg) Newsgroups: comp.unix.questions Subject: Re: Changing upper-case filenames to lower-case Message-ID: <25747F32.4268@ateng.com> Date: 30 Nov 89 01:15:28 GMT References: <3116@jarthur.Claremont.EDU> <5249@omepd.UUCP> Distribution: na Organization: A T Engineering, Tampa, FL Lines: 27 According to merlyn@iwarp.intel.com (Randal Schwartz): >perl -e 'for$f(<*>){($_=$f)=~y/A-Z/a-z/;rename($f,$_)unless$f eq$_;}' I'd think that "<*>", which runs "/bin/sh echo", should be avoided. Rather, you'd be better off reading the directory directly... eval 'exec /bin/perl -S $0 ${1+"$@"}' if 0; # Get all the files' names opendir(DOT,".") || die "$0: can't read \".\": $!\n"; @F = readdir(DOT); closedir(DOT); @F = sort @F; # Rename some of them foreach $f (@F) { next if $f =~ /^\./; # Don't mess with invisible files ($_ = $f) =~ y/A-Z/a-z/; rename($f, $_) unless $f eq $_; } Yet Another Perl Hacker, -- You may redistribute this article only to those who may freely do likewise. Chip Salzenberg at A T Engineering; or "The Usenet, in a very real sense, does not exist."