mv *.foo *.bar
unfortunately, this is not how you rename the extensions of multiple files in one go. the shell can't match *.bar and the mv command just doesn't work that way... here is one option for bulk renaming on unix: find . -name *.foo | sed "s/\(.*\)\.foo$/mv '&' '\1.bar'/" | sh it concatenates one mv command per file and pipes all commands to a shell. performing a search/replace over a big file system tree is another task which sounds very easy but is actually quite tricky. surprised that my java IDE (eclipse) doesn't offer anything alike, i switched to good'ol bash when i recently had to replace all occurrences of "foo" with "bar" in our source tree*: find . -name "*.java" | xargs sed -i -e "s/foo/bar/g" this seemed to work quite well. however, eclipse reported 42 zillion outgoing cvs changes (while probably only about 20 files contained the "foo" string). this behavior is intrinsic to sed (the stream editor) and the -i argument (the in place editing): sed reads the file, edits the stream, writes the result to a tmp file, and finally overwrites the original file with the tmp file. this last step is done for every single file, irrespective of whether an actual edit has been performed or not. if you don't want the timestamps to change, you thus need to sneak in an additional grep command: find . -name "*.java" | xargs grep -l foo | xargs sed -i -e "s/foo/bar/g" comments and sexy alternatives are very welcome! * no, we don't actually spend our afternoons replacing "foo" with "bar" at genedata... but i just don't want to rant about the difference between a java.security.InvalidParameterException and a java.lang.IllegalArgumentException any further ;-)
