home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / unix / question / 10742 < prev    next >
Encoding:
Internet Message Format  |  1992-09-07  |  1.4 KB

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