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

  1. Path: sparky!uunet!dtix!darwin.sura.net!haven.umd.edu!news.umbc.edu!math13.math.umbc.edu!rouben
  2. From: rouben@math13.math.umbc.edu (Rouben Rostamian)
  3. Newsgroups: comp.unix.questions
  4. Subject: Re: need script to rename uppercase filenames
  5. Message-ID: <1992Sep3.120607.25089@umbc3.umbc.edu>
  6. Date: 3 Sep 92 12:06:07 GMT
  7. References: <699@svcs1.UUCP> <1992Sep3.083107.11920@athena.mit.edu>
  8. Sender: newspost@umbc3.umbc.edu (News posting account)
  9. Organization: University of Maryland Baltimore Campus, Academic Computing Services
  10. Lines: 30
  11.  
  12. In article <1992Sep3.083107.11920@athena.mit.edu> benjy@athena.mit.edu (Benjamin B Thomas) writes:
  13. >In article <699@svcs1.UUCP> slix@svcs1.UUCP (Bill Miller) writes:
  14. >> 
  15. >>I have some source code in DOS (many separate files) that I tarred under
  16. >>DOS and untarred under 386BSD.  The big problem is that all the files
  17. >>came through in UPPERCASE and I need a script to mv (rename) them all
  18. >>to lowercase quickly.
  19. >
  20. >Try:
  21. >
  22. >#!/bin/csh 
  23. >foreach i ($argv)
  24. >setenv file $i
  25. >cat $file | tr -d '\015' > `echo foo | nawk '{print tolower(ENVIRON["file"])}'`
  26. >rm $file
  27. >end
  28.  
  29. I would suggest the quicker script:
  30.  
  31. #!/bin/sh
  32. for file in *[A-Z]*
  33. do
  34. mv $file `echo $file | tr '[A-Z]' '[a-z]'`
  35. done
  36.  
  37. This script changes all files names containing an uppercase letter 
  38. in the current directory to lowercase.  I would not strip the \015s
  39. so casually without knowing the contents of the files.
  40.  
  41. --RR
  42.