commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Frank van der Kleij <kl...@hotmail.com>
Subject RE: [fs] Problem with FTP:
Date Fri, 13 Aug 2010 05:42:06 GMT

I think you that your code is converting the target folder to the source file.  It is a bit
strange and dangerous as well the way VFS works, I once deleted a folder with lots of semi-important
files like that...
You should first resolve the full path of the target file:
FileObject targetFile = fsManager.resolveFile("ftp://myuser:mypassword@mysite.net/home/myuser/test-xls/test.txt");
Or:
FileObject targetFile = fsManager.resolveFile("ftp://myuser:mypassword@mysite.net/home/myuser/test-xls").resolveFile(sourceFile.getName().getBaseName());
(Or something similar, I didn't check the exact syntax...)
Cheers,
Frank

> From: list-subscriptions@secmgmt.com
> To: user@commons.apache.org
> Subject: [fs] Problem with FTP:
> Date: Thu, 12 Aug 2010 12:16:57 -0400
> 
> I have the following URL:
> 
> ftp://myuser:mypassword@mysite.net/home/myuser/test-xls
> 
> and am trying to copy a file into that directory.
> 
> Here is the code I'm using:
> 
> 				FileObject sourceFile =
> fsManager.resolveFile("/tmp/test.txt");
>                         FileObject targetFile =
> fsManager.resolveFile("ftp://myuser:mypassword@mysite.net/home/myuser/test-x
> ls");
>                         targetFile.copyFrom(sourceFile, new
> AllFileSelector());
> 
> I don't get an error, and I know it can connect because I get an exception
> if I break the password or site name.  Any ideas why the put is not working?
> 
> Thanks,
> Mike.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
> 
 		 	   		  
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message