List of usage examples for java.io File list
public String[] list()
From source file:Main.java
private static boolean deleteDir(File dir) { if (dir.isDirectory()) { String[] children = dir.list(); for (int i = 0; i < children.length; i++) { boolean success = deleteDir(new File(dir, children[i])); if (!success) { return false; }/*from w w w. j av a 2 s . c o m*/ } } // The directory is now empty so delete it return dir.delete(); }
From source file:Main.java
private static void deleteDirectory(File directory) { if (directory.isDirectory()) { for (String item : directory.list()) { new File(directory, item).delete(); }/*from w w w . ja va2s .c o m*/ directory.delete(); } }
From source file:Main.java
/** * IF THE DIRECTORY IS NOT EMPTY . USE THIS FUNCTION *///from w w w. j ava 2 s . co m public static boolean deleteNon_EmptyDir(File dir) { if (dir.isDirectory()) { String[] children = dir.list(); for (int i = 0; i < children.length; i++) { boolean success = deleteNon_EmptyDir(new File(dir, children[i])); if (!success) { return false; } } } return dir.delete(); }
From source file:Main.java
static public void deleteAllSDContent() { String dir_path = Environment.getExternalStorageDirectory().getPath() + "/swift"; File f = new File(dir_path); if (f.isDirectory()) { String files[] = f.list(); for (int i = 0; i < files.length; i++) { new File(dir_path, files[i]).delete(); }//from www.j ava 2s . c om } }
From source file:Main.java
private static boolean deleteDir(File dir) { if (dir != null && dir.isDirectory()) { String[] children = dir.list(); for (String aChildren : children) { boolean success = deleteDir(new File(dir, aChildren)); if (!success) { return false; }//from w ww . j av a 2 s.c o m } } return dir != null && dir.delete(); }
From source file:Main.java
private static boolean deleteDir(File dir) { if (dir != null && dir.isDirectory()) { String[] children = dir.list(); for (int i = 0; i < children.length; i++) { boolean success = deleteDir(new File(dir, children[i])); if (!success) { return false; }// w w w . j a v a2s. c o m } } return dir != null && dir.delete(); }
From source file:Main.java
private static boolean deleteDir(File dir) { if (dir != null && dir.isDirectory()) { String[] children = dir.list(); for (String aChildren : children) { boolean success = deleteDir(new File(dir, aChildren)); if (!success) { return false; }/*from ww w.j av a 2 s . c o m*/ } } return dir.delete(); }
From source file:Main.java
public static boolean delectFileByDir(File file) { if (file != null && file.isDirectory()) { String[] files = file.list(); for (String cach : files) { boolean result = delectFileByDir(new File(file, cach)); if (!result) { return false; }/* w ww . ja v a2 s .c o m*/ } } return file.delete(); }
From source file:Main.java
public static boolean deleteDir(File dir) { if (dir != null && dir.isDirectory()) { String[] children = dir.list(); for (String aChildren : children) { boolean success = deleteDir(new File(dir, aChildren)); if (!success) { return false; }/* w w w .j a v a2 s . com*/ } } assert dir != null; return dir.delete(); }
From source file:Main.java
public static boolean deleteDir(File dir) { if (dir != null && dir.isDirectory()) { String[] childFiles = dir.list(); for (String s : childFiles) { boolean success = deleteDir(new File(dir, s)); if (success == false) { return false; }//from w w w . j av a 2 s .com } } return dir.delete(); }