Q:

changing all occurrences of a string in filenames and their content

I have code of the form:
myfile/foo/Foo.java:

    public class Foo() {
         System.out.println("I'm a Foo");
    }

in an arbitrarily deep directory tree and I'd like to change all occurrences of "foo" to "bar" , "Foo" to "Bar", etc. in both filenames and content automatically. (I'm happy to do these sequentially, changing the substitution strings each time - there's a limited number of lexical forms).
myfile/bar/Bar.java:

    public class Bar() {
         System.out.println("I'm a Bar");
    }

I use Eclipse and if there are tools in it that would work. I suspect it's easier to use a UNIX script. If so I would be grateful for an example as my UNIX is rusty and this need not be Java-specific.

A:

it is not super elegant but you can do it in two steps :

Rename files with a native multi file rename utility. I personally prefer KRename it is a GUI tool and available on most linux distributions. this will only rename the file names, but not the content
In eclipse you can do a replace strings in multiple files with the Search/Search/Replace command (or just look for the compilation errors and apply a quick fix for all)

