Hi Geek (!)
I tried to use your example in my local file system, and ti doesn't work.
I just change the path of the new path, cutting off the first "/" and it
works.
> FileObject f = fo.resolveFile("mynewfolder/myfile.txt");
Try that and good luck,
Ernesto.
geek.shrek escribió:
Hi,
I'm trying to create a file using VFS FTP but it said the file already exist
eventhough it's not exists
Could not create folder "ftp://myuser:[email protected]/" because it
already exists and is a file
Here's my code.
try
{
FileObject fo = fsManager.resolveFile("ftp://myuser:[email protected]", authenticate());
FileObject f = fo.resolveFile("/mynewfolder/myfile.txt");
System.out.println("f " + f.exists()); --> return false;
f.createFile();
System.out.println("Is readable: " + f.exists());
System.out.println("Last Modified" + f.getContent().getLastModifiedTime());
}
catch (FileSystemException e)
{
e.printStackTrace();
}
private FileSystemOptions authenticate()
{
StaticUserAuthenticator auth = new StaticUserAuthenticator(null,
this.username, this.password);
FileSystemOptions opts = new FileSystemOptions();
try
{
DefaultFileSystemConfigBuilder.getInstance().setUserAuthenticator(opts, auth);
}
catch (FileSystemException e1)
{
e1.printStackTrace();
}
return opts;
}
Could someone please point me how can I create file using VFS?
Thanks,
__________________________________________________________________________________
Get more done like never before with Yahoo!7 Mail.
Learn more: http://au.overview.mail.yahoo.com/