Created
September 13, 2010 15:22
-
-
Save Riduidel/577451 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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