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

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

asp.net core mvc - How important is the global.json and src folder? -

c++ - Using Gtest how return different values in ON_CALL? -