1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| public static boolean searchFile(String file) {
File fichier = new File(file);
String absolutePath = fichier.getAbsolutePath();
String filePath;
int exist = 0;
filePath = absolutePath.substring(0,absolutePath.lastIndexOf(File.separator));
File dir = new File(filePath);
FileFilter fileFilter;
fileFilter = new WildcardFileFilter(".*");
File[] files = dir.listFiles(fileFilter);
for (int i = 0; i < files.length; i++) {
if (files[i].isFile())
{
++exist;
};
}
if (exist > 0) return true;
else return false;
}//searchFile |
Partager