2
The directory has 6 files inside it. The exception is java.io.Ioexception: Unable to delete file: tmp umDosArchives. Manually, I can delete all the files and the directory. I used the canWrite method, from File, to see if there was any lock, but it always returns true. File access permissions are also correct. What may be happening?
File tmpDir = new File("tmp");
if (tmpDir.exists()) {
FileUtils.deleteDirectory(tmpDir);
}
Put the code you are using to do the deletion.
– Celso Marigo Jr
I posted the code. The exception occurs in Fileutils.deleteDirectory
– ewerton
The File.delete command, for directory, or in the case File.eleteDirectory, is unclear whether this is also true, http://commons.apache.org/proper/commons-io/apidocs/org/apache/commons/io/FileUtils.html, will only work for empty directories. And always in java, pass the full path. Check this article, alias the articles on this site are very good: http://www.mkyong.com/java/how-to-delete-directory-in-java/
– Celso Marigo Jr
From what I understand, File.deleteDirectory should work because it says it deletes recursively. The article code worked and is very good. Thank you!
– ewerton
@user1902062 publish a response with the solution found.
– Fagner Fonseca