In my java program I copy a file and delete the new file.
In my method removeFile()
I check if it is a directory:
String fileName = "G:/1310628353186Examples.csv";
File f = new File(fileName);
if (f.isDirectory()) {
System.out.println( "'" + fileName + "' is a directory" );
String[] files = f.list();
if (files != null && files.length > 0)
throw new IllegalArgumentException("Delete: directory not empty: " + fileName);
}
Sometimes I get "'G:/1310628353186Examples.csv' is a directory"
, sometimes I don't.
When I debug the code and f.isDirectory()
is true
and I check what is in f.isDirectory
, the debugger says that it's false
.
I'm running Eclipse SDK 3.4.0 and JDK 1.6 on Windows 7 Professional.