#scriptshell#----------------------echoRemoving$1rm-r$1echoCreating$1mkdir$1#javamethod/** * Remove a directory using shell command * @param scriptFileName shell script containing the command * @param inputDir directory to be removed and newly created**/publicstaticvoidRemoveAndMakeDir(StringscriptFileName,StringinputDir){Filed=newFile(inputDir);if(d.isDirectory()){try{Runtimert=Runtime.getRuntime();//Processpr=rt.exec("cmd /c dir");System.out.println("Removing and Recreating directory '"+inputDir+"'");Processpr=rt.exec(scriptFileName+" "+inputDir);pr.waitFor();}catch(Exceptione){System.out.println(e.toString());e.printStackTrace();}}else{d.mkdir();}}
Last edit: Duy Dinh 2014-04-11
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Last edit: Duy Dinh 2014-04-11