[File instance].exists() only check case insensitive.
If you want check case sensitive, below code help you.
1 2 3 4 5 6 7 8 9 |
String filePath = "C:\...\Abc.txt"; File file = new File(filePath); if(file.exists() && file.getCanonicalPath().equals(filePath)){ // file exists return true; }else{ // file is not exist return false; } |