java - Deleting specified file -


i'm trying delete files isn't working or i'm missing something. here little test i'm doing:

private void deletefromdir(string filename) {     string path = "./test/pacientes/" + filename + ".tds";      file f = new file(path);      system.out.println("abs path " + f.getabsolutepath());     system.out.println("exist " + f.exists());     system.out.println("filename " + f.getname());     system.out.println("delete " + f.delete());  } 

and system prints:

abs path c:\users\xxxx\documents\pai\tsoft.\test\pacientes\john smith.tds
exist true
filename john smith.tds
delete false

and of course isn't deleting file, why? how can make work?

perhaps, not have permission delete file. can use files.delete() method, throws ioexception, in case goes wrong, see real problem is.


Comments

Popular posts from this blog

javascript - How to process users in one specific order using map o each function? -

javascript - Linking from page A to a specific iframe on page B -

java - Two interface have same method name with different return type -