HELP converting filenames!

Rusty Carruth rusty at cadnetix.COM
Sat Oct 7 01:18:14 AEST 1989


In article <5003 at omepd.UUCP> merlyn at iwarp.intel.com (Randal Schwartz) writes:
>In article <9234 at pyr.gatech.EDU>, david at pyr (David Brown) writes:
>| 
>| Hiya.  I have a friend who has about 200 files in a directory that are all
>| upper case.  They are data files that need to be in lower case, because
>| his brain-dead program won't recognize upper case letters.  
>
>Yeah, in Perl, it'd be:
>...
>But, if you don't have Perl (shame on you!), here's the /bin/sh (et. al.)
>solution:
>
<solution requiring 'tr'>
>
Of course, if all else fails, do my favorite trick which I use
whenever all else fails.  Make a script.

First, go to the directory of interest and do 'ls -1 > doit'.
Chmod 777 doit. Now, go edit 'doit' (for all you emacs haters
out there, sorry but emacs seems to work better for what I'm about
to suggest than does vi) and make a macro (sorry folks, this
trick will pretty much require emacs) which adds a space or two
to the end of the current line and then copies that line to its
end (making a line like 'file' end up as 'file  file  ' - If
you have a problem with the trailing space, make the macro
a bit different), and then changes the added information to
all lower case, then goes to the next line.  Now, execute 
that macro 200 times.  Now go back and add the 'mv' command to
the front of each line (another macro).  Don't forget
your #!/bin/csh (or sh), close and save, execute it,
and you are done.

And you could have moved them to another directory in the
process (or every other one to a different dir...) had you
wanted to.

not as elegant as the other solutions?  Sure.  But it
will get the job done.
---Join the usenet un-net, 28.410 and/or 28.390, 1500Z to 1600Z saturdays!
Rusty Carruth.                  Radio: N7IKQ              ^^ or later :-)  
DOMAIN: rusty at cadnetix.com      UUCP:{uunet,boulder}!cadnetix!rusty   
home: POB. 461, Lafayette 80026



More information about the Comp.unix.wizards mailing list