L
Lee
Hi there,
I wonder if anyone can offer me some advice. I'm trying to pass a
filename (full path and filename e.g. C:/usr/local/myfile.txt) to a
method, and have the file created. Before doing so, I must make sure
that the directories exist!
I do the following
---- passing in file='C:/usr/local/myfile.txt'--
String absolutePath = file.getPath();
File path = null;
path = new File( absolutePath);
if ( !path.exists()){
System.out.println("creating " + path);
boolean success = path.mkdirs();
<snip>
-------------------------------------------------
But that creates a directory called myfile.txt in /usr/local! Can anyone
tell me if there's a way to make it know that myfile.txt is a file, not
a directory?
Thanks very much in advance,
Lee
I wonder if anyone can offer me some advice. I'm trying to pass a
filename (full path and filename e.g. C:/usr/local/myfile.txt) to a
method, and have the file created. Before doing so, I must make sure
that the directories exist!
I do the following
---- passing in file='C:/usr/local/myfile.txt'--
String absolutePath = file.getPath();
File path = null;
path = new File( absolutePath);
if ( !path.exists()){
System.out.println("creating " + path);
boolean success = path.mkdirs();
<snip>
-------------------------------------------------
But that creates a directory called myfile.txt in /usr/local! Can anyone
tell me if there's a way to make it know that myfile.txt is a file, not
a directory?
Thanks very much in advance,
Lee