I have a problem while deleting files from img directory using org.apache.commons.io.FileUtils. I am using this code:
File dir = new File(".\\img");
    FileFilter fileFilter = new WildcardFileFilter(userId + ".*");
    File[] files = dir.listFiles(fileFilter);
    System.out.println("files found: " + files.length);
    for (int i = 0; i < files.length; i++) {
        boolean success = FileUtils.deleteQuietly(files[i]);
        System.out.println(files[i] + " delete result = " + success);
    }
}
Actually the code is using for replacing image files existed in img directory with the new one. I need to delete all previously existed files which names are n.*, with the new file e.g. n.png. If I am trying to delete image files, I get false value for the variable success and the files are not deleted. But not image files e.g. *.abc; *.acd; *.acdc etc. are deleted succesfully. What is the case of this issue?
 
     
     
     
    