home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!gumby!wmichgw!x91clifton1
- From: x91clifton1@gw.wmich.edu
- Newsgroups: comp.unix.questions
- Subject: Re: need script to rename uppercase filenames
- Message-ID: <1992Sep4.162344.5138@gw.wmich.edu>
- Date: 4 Sep 92 16:23:44 EST
- References: <699@svcs1.UUCP> <1992Sep03.151245.11128@Celestial.COM> <1992Sep4.162044.2242@netlabs.com>
- Organization: Western Michigan University
- Lines: 31
-
- In article <1992Sep4.162044.2242@netlabs.com>, lwall@netlabs.com (Larry Wall) writes:
- > In article <1992Sep03.151245.11128@Celestial.COM> bill@Celestial.COM (Bill Campbell) writes:
- > : s/\s+$//; # strip all trailing whitespace including ^M
- >
- > Unfortunately, that also deletes the ^J. Since the script unlinks the
- > DOS file, you've just thrown away information that's not easily
- > reconstructable. (In fact, the files won't even be editable unless you
- > use GNU emacs.) It would be safer to move the DOS file to a temporary
- > subdirectory until you're sure the translation works right.
- >
- > I don't want to discourage anyone from helping people, but help is not
- > what booby traps are generally construed as... :-)
- >
- > Larry Wall
- > lwall@netlabs.com
-
- Since this post is from Larry Wall how about:
-
- #!/usr/local/bin/perl
- # lwr--change uppercase filenames to lowercase.
-
- foreach $upr (@ARGV) {
- ($lwr = $upr) =~ y/A-Z/a-z/;
- rename($upr, $lwr) || die "lwr: $upr->$lwr: $!\n";
- }
-
- ;-)
-
- /Doug
- --
- Douglas Clifton [99clifto@lab.cc.wmich.edu]
-