commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ernesto De Santis <eds_li...@yahoo.com.ar>
Subject Re: [Bulk] Failed creating file using VFS FTP
Date Sat, 26 Sep 2009 19:11:52 GMT
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:mypass@123.345.678.890/" because it already exists
and is a file
>
> Here's my code.
>
>         try
>         {
>    
>             FileObject fo = fsManager.resolveFile("ftp://myuser:mypass@123.345.678.890",
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/
>   

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message