commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "geek.shrek" <>
Subject Failed creating file using VFS FTP
Date Fri, 09 Oct 2009 03:44:23 GMT
Thanks Ernesto for the reply,

yes I can create file on my local file system as well.
But when I changed to ftp, I'm still can't create the file.

Error said "Could not create file ftp://myuser:mypassword@123.345.678.890/mynewfolder/myfile.txt"
"Could not create folder "ftp://myuser:mypassword@123.345.678.890/ beacuse it already exists
and is a file"

I test this ftp by reading a file that already exist and it's fine. but when I want to create
it failed.

Any ideas?
Thanks again,

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,

geek.shrek escribió:


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:myp...@123.345.678.890/"; because it 
already exists and is a file

Here's my code.

FileObject fo = fsManager.resolveFile("ftp://myuser:myp...@123.345.678.890";, authenticate());

            FileObject f = fo.resolveFile("/mynewfolder/myfile.txt");
            System.out.println("f " + f.exists());  --> return false;
System.out.println("Is readable: " + f.exists()); System.out.println("Last Modified" + f.getContent().getLastModifiedTime());

        catch (FileSystemException e)

private FileSystemOptions authenticate()
        StaticUserAuthenticator auth = new StaticUserAuthenticator(null, 
this.username, this.password);
        FileSystemOptions opts = new FileSystemOptions();

DefaultFileSystemConfigBuilder.getInstance().setUserAuthenticator(opts, auth);
        catch (FileSystemException e1)
        return opts;

Could someone please point me how can I create file using VFS?


Get more done like never before with Yahoo!7 Mail.
Learn more:
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message