There was a discussion about this back on Jan 23-24. It's covered better than anything I could write. Check the archives. Look for a subject to the effect of: "Batch rename files" Bryan
Below is the method I would choose (from 1 of the messages in that thread): --------------- A low-tech bash-only way to do this is: for n in foo-*-bar-*.txt; do nn=${n/-bar-/-}; mv $n ${nn/foo/blah}; done I actually use this quite often when I need to replace only one part of the name. Plus you get to preview your changes when you replace `mv' by `echo' in a dry run. This was for the `easiest way' part. Complex replacements get tedious with this technique, though. If you're feeling really brave and are the do-it-yourself kind of person, you won't want to resort to mmv or something else that is designed for the job. You use sed to assemble a stream of commands that you pipe into a shell: ls foo-*-bar-*.txt | sed 's/\(foo\(.*\)bar-\(.*\)\)/mv \1 blah\2\3;/' | sh or so. For increased power/obfuscation, you could pipe the output of find into sed. This enables you to rename files in a whole directory tree, and move them through the filesystem in interesting ways (flattening directory hierarchies, for instance). This makes for beautiful sed patterns, because the `/'s need to be escaped in sed: find -type f | sed -e h -e 's/\.\///' -e 'y/\//-/' -e x -e G \ -e 's/\n/ /' -e 's/\(.*\)/mv \1;/' | sh would transform foo.txt for/bar.txt a/very/very/long/path/and/then/some.more into foo.txt for-bar.txt a-very-very-long-path-and-then-some.more leaving some empty directories behind. Now if you choose not to quote the sed expressions, because you could as well escape them, you get find -type f | sed -e h -e s/\\.\\/// -e y/\\//-/ -e x -e G \ -e s/\\n/\ / -e s/\\\(.\*\\\)/mv\ \\1\;/ | sh I think this has a certain ring to it. Of course, my sed expressions might be overly complicated, as complete mastery of sed is not really simple to attain for mere mortals. ------------------- On 01-Mar-2000 Ethan Benson wrote: > On Wed, Mar 01, 2000 at 10:14:58AM -0500, Bryan Scaringe wrote: >> Perhaps either xfs-xtt of mkttfdir expect font files to have a lowercase >> file extention. Remeber .MP3 is different than .mp3, and .JPG is different >> than .jpg, so it's not hard to imagine that this could be your problem. > > damn, that might be it... do you happen to know of a way to lowercase > letters in bash or some other way? i don't really want to mv THIS.TTF > this.tff 215 times.... > > MS never ceases to inconvenience... > >> Bryan >> >> >> > there is mkttfdir in fttools package. >> > >> >> Another question: Once I create fonts.dir, are there any other steps >> >> to configure the font server to use the ttf fonts? >> > >> > i wnat to know this too, i installed xfs-xtt and used the above tool >> > on a couple fonts i got from MS' gratis fonts page, and they showed up >> > and were usable in netscape. but these were not enough fonts so i >> > nabbed all the fonts from NT 4 and used the same utility which >> > generated the fonts.dir file just fine it looks like, but now none of >> > them are available for use in X, only the original X bitmapped fonts >> >:( >> > >> > i cannot find any difference, except that this time i did not fix all >> > the ugly MSDOS 8.3 filenames to lowercase but i don't see how that >> > would matter. (its amazing even with a somewhat advanced filesystem >> > like NTFS that you still end up with fscking 8.3 filenames when you >> > archive files...) >> > >> > -- >> > Ethan Benson >> > >> > >> > -- >> > Unsubscribe? mail -s unsubscribe [EMAIL PROTECTED] < >> > /dev/null >> > > -- > Ethan Benson