Newsgroups: comp.unix.questions Path: utzoo!sq!lee From: lee@sq.sq.com (Liam R. E. Quin) Subject: Re: Changing upper-case filenames to lower-case Message-ID: <1989Dec7.020047.8178@sq.sq.com> Reply-To: lee@sq.com (Liam R. E. Quin) Organization: Unixsys (UK) Ltd References: <3116@jarthur.Claremont.EDU> <5249@omepd.UUCP> <25747F32.4268@ateng.com> Distribution: na Date: Thu, 7 Dec 89 02:00:47 GMT In article <25747F32.4268@ateng.com> chip@ateng.com (Chip Salzenberg) writes: >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. >[much longer solution deleted] Er, am I missing something? for i in * do mv $i `echo $i | tr '[A-Z]' '[a-z]'` done If you only want to move some of the files, change * to `pick *` (if you have pick -- see ``The Unix Programming Environment'' (Kernighan & Pike) for the source to pick if you don't) If you also want to rename files that begin with a dot, replace the * with `ls -a`, and use `find . -type f -print` to include files in subdirectories and exclude subdirectories... Is the issue really minimising the number of characters typed, getting the most easily understood solution, or simply doing as much as possible in perl? Do you get brownie points for the most cryptic perl one-liner? 0.5 :-) Incidentally, one common way of getting lots of files in upper case on a 386 Unix system is by using some of the "dosget" or "doscp" programs. In this case, it's worth writing a simple script that takes the output of "dosdir" or "dosls" and generates a sequence of commands that copy the files into lower case names. Some versions of "dosget" have an option to do this. Lee -- Liam R. Quin, Unixsys (UK) Ltd [note: not an employee of "sq" - a visitor!] lee@sq.com (Whilst visiting Canada from England, until Christmas) -- I think I'm going to come out at last... -- What? Admit you're not a fundamentalist Jew? They'll *crucify* you! :-)