Hi all,
I want to run an OS command from my Java code. Basically I want to delete an unknown number of file from a particular directory from my Java code (in windows). But the way "del *.*" commnad works it prompts you whether you want to delete it or not. How can I delete those temp files without answering "y"es to the prompt from my code?
Please advise...
Here's what I tried:
private String destDir = "C:\\temp\\";
....
private void deleteFiles() {
try {
Process p = Runtime.getRuntime().exec("del " + destDir + "*.*");
} catch (IOException e) {
logger.debug("Can't delete: " + e.getMessage() );
}
}
Thanks.