Skip to content

Instantly share code, notes, and snippets.

@RomanVlasenko
Last active December 30, 2015 09:19
Show Gist options
  • Save RomanVlasenko/7808557 to your computer and use it in GitHub Desktop.
Save RomanVlasenko/7808557 to your computer and use it in GitHub Desktop.
Copy resource files from java to resources folder (maven style)
import java.io.File;
import java.io.IOException;
/**
* @author Roman Vlasenko (RVL) / WorldTicket A/S
* @version $Revision: 1.0 $ $Date: 12/5/13 $
*/
public class FileMover {
public static void main(String args[]) {
final String SEARCH_FOLDER = "/home/rvl/projects/worldticket/maven/sms-test-integration/src/test/java/net/worldticket/tools";
try {
displayIt(new File(SEARCH_FOLDER));
} catch (IOException e) {
e.printStackTrace();
}
}
public static void displayIt(File node) throws IOException {
if (!node.getAbsoluteFile().getName().endsWith(".java") && node.getAbsoluteFile().isFile()) {
System.out.println("hg mv " + node.getAbsoluteFile().toString() + " " + node.getAbsoluteFile().toString().replace("/java/", "/resources/"));
}
if (node.isDirectory()) {
String[] subNote = node.list();
for (String filename : subNote) {
displayIt(new File(node, filename));
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment