Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!wuarchive!cs.utexas.edu!uunet!cadnetix.COM!cadnetix!rusty From: rusty@cadnetix.COM (Rusty Carruth) Newsgroups: comp.unix.wizards Subject: Re: HELP converting filenames! Message-ID: <9754@cadnetix.COM> Date: 6 Oct 89 15:18:14 GMT References: <9234@pyr.gatech.EDU> <5003@omepd.UUCP> Sender: news@cadnetix.COM Reply-To: rusty@cadnetix.COM (Rusty Carruth) Organization: Cadnetix Corp., Boulder, CO Lines: 42 In article <5003@omepd.UUCP> merlyn@iwarp.intel.com (Randal Schwartz) writes: >In article <9234@pyr.gatech.EDU>, david@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: > > 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@cadnetix.com UUCP:{uunet,boulder}!cadnetix!rusty home: POB. 461, Lafayette 80026