Beispiel #1
0
  public static void delete(File file) {
    if (file.isFile()) file.delete();

    File[] files = file.listFiles();
    if (files != null) { // some JVMs return null for empty dirs
      for (File f : files) {
        if (f.isDirectory()) {
          delete(f);
        } else {
          f.delete();
        }
      }
    }
    file.delete();
  }
Beispiel #2
0
  // returneaza true daca entry reprezinta un director si false in caz contrar
  public boolean isDirectory(String entry) {

    try {
      String targetPath = currentPath + "\\" + entry;
      File file = new File(targetPath);
      if (!file.exists()) System.out.println("Fisierul nu exista");
      if (file.isDirectory()) {
        System.out.println(entry + " este un director");
        return true;
      } else {
        System.out.println(entry + " nu este un director");
        return false;
      }
    } catch (Exception e) {
      return false;
    } finally {
      takePath();
    }
  }