| | |
Force Delete?
Thread Solved |
•
•
Join Date: Apr 2007
Posts: 126
Reputation:
Solved Threads: 6
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:
Thanks.
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:
Java Syntax (Toggle Plain Text)
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.
Last edited by new_2_java; Jan 31st, 2008 at 1:57 pm.
![]() |
Similar Threads
- fstream Tutorial (C++)
- Simulate Mouse Move (C++)
- can't delete recycle bin files and others (Windows NT / 2000 / XP)
- Possibly the worst computer mess ever (Viruses, Spyware and other Nasties)
- How can I delete Hosts: 1159680172 auto.search.msn.com? (Viruses, Spyware and other Nasties)
- For Mattis: Hijackthis log (Help please!) (Viruses, Spyware and other Nasties)
- Still Having Run.DLL Problems (Viruses, Spyware and other Nasties)
- Dns error (Viruses, Spyware and other Nasties)
- How do I erase all info stored in and by the address line on my browser? (Windows NT / 2000 / XP)
Other Threads in the Java Forum
- Previous Thread: at runtime, it gives me applet not initialized and the JTextArea is not show
- Next Thread: shuffle deck
| Thread Tools | Search this Thread |
3d 6 @param affinetransform android api applet application arc array arrays automation binary bluetooth bold byte c++ chat class client code color compare component coordinates database detection doctype eclipse educational error file fractal froglogic game givemetehcodez graphics gui guitesting helpwithhomework html ide ideas image ingres input integer internet intersect j2me java java.xls javaexcel javaprojects jni jpanel jtextarea julia keytool keyword linux list loop map method methods mobile netbeans newbie nextline object pong print problem producer program programming project projectideas read recursion recursive replaysolutions rim scanner sell server set size sms sort sql string swing terminal threads tree web websites windows






