Skip to content

Instantly share code, notes, and snippets.

@Riduidel
Created September 13, 2010 15:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Riduidel/577451 to your computer and use it in GitHub Desktop.
Save Riduidel/577451 to your computer and use it in GitHub Desktop.
File root = new File("Un chemin à changer") // MODIFIEZ CE CHEMIN
public class Utl {
public static void execute(String s, File directory) {
def initialSize = 4096
def outStream = new ByteArrayOutputStream(initialSize)
def errStream = new ByteArrayOutputStream(initialSize)
def proc = s.execute([], directory)
proc.consumeProcessOutput(outStream, errStream)
System.out.println "executed "+s+" for result "+proc.waitFor()
System.out.println outStream
System.err.println errStream
}
}
root.eachFileRecurse {File f ->
String path = f.getAbsolutePath();
String name = f.getName();
String newname = name;
if(!path.contains(".svn")) {
newname = newname.replace("# ", "");
newname = newname.replace(' ', '_');
newname = newname.replace('#', '');
if(newname!=name) {
Utl.execute("svn move \""+name+"\" "+newname, f.getParentFile())
if(f.isDirectory()) {
// Utl.execute("svn commit -m \"renamed directory to remove weird characters\"", f)
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment