Advertisement
Guest User

Untitled

a guest
Oct 24th, 2014
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.78 KB | None | 0 0
  1. public void startProgram() {
  2.     try {
  3.         deleteWDB(configuration.getPath() + File.separator + "WDB");
  4.         // runtime and other stuff
  5.     } catch (IOException e) {
  6.         // stuff
  7.     }
  8. }
  9.  
  10. public void deleteWDB(String path) {
  11.     File file = new File(path)
  12.     if (file.isDirectory())
  13.         File files[] = file.getFiles() // might be something like listFiles or something with list
  14.         foreach File f in files
  15.             deleteWDB(f.getAbsolutePath()); // should be a function that at least semantically is called this
  16.     } else if (file.exists()) { // or some variation of file validation to make sure its an actual file
  17.         System.out.println(file.getAbsolutePath()); // just for debug, keep this in and next line uncommented until fully bugtested to make sure you dont delete accidental files
  18.         file.delete()
  19.     }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement