commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chandrasekhar, Preetham" <preetham.chandrasek...@citigroup.com>
Subject RE: FileUtils question..
Date Fri, 10 Sep 2004 15:39:04 GMT
Hi Mark et all,
Now it makes sense. My code just gets the string representation of the dile in the ftp but
doesnt establish any connection. Any idea on how to establish connection with the ftp or modify
a file on the ftp and can this be done using FileUtils alone? Say not ftp alone, even if i
try using the URI representation of a file on my pc...for example: "file://C://temp/try.txt",
it says the file cant be found. Any suggestions on the above problems.
Your help would be really appreciated.
Thank you so much
Preetham

-----Original Message-----
From: Mark Drew [mailto:MDrew@realm.com]
Sent: Friday, September 10, 2004 8:32 AM
To: 'Jakarta Commons Users List'
Subject: RE: FileUtils question..


Preetham,

I think you have a fundamental misunderstanding of the getFile() method of
the URL class (and possibly the File class).  Note that it only returns a
String representation of the file part of the URL.  The code that you have
included will NOT do ANY communication with an FTP server.  Suggest you read
up on these classes/methods.

Mark

-----Original Message-----
From: Henri Yandell [mailto:flamefew@gmail.com] 
Sent: Thursday, September 09, 2004 4:43 PM
To: Jakarta Commons Users List
Subject: Re: FileUtils question..


Easiest thing would be to grab the source for
FileUtils.copyFile(File,File,boolean) from
http://jakarta.apache.org/commons/io/xref/org/apache/commons/io/FileUtils.ht
ml
insert this in your code, and try removing some of the bits to see
what exactly is stopping the access, or if it's a problem in the
underlying JDK (ie your system somehow).

 Looking at FileUtils.copyFile(File,File,boolean), and
CopyUtils.copy(InputStream,OutputStream); there doesn't seem to be
anything obviously bad, however maybe the FTP code in Java doesn't
like the checks at the front of copyFile.

Hen

On Thu, 9 Sep 2004 15:17:53 -0400, Chandrasekhar, Preetham
<preetham.chandrasekhar@citigroup.com> wrote:
> Hi,
> I am having trouble with accessing the ftp using the FileUtils class in
the commons.io package of the Jakarta project.
> Here's the extract of my code which i assume will make sense:
> 
> url_copytodir = new
URL("ftp://root:pass@aaaaaa.aaa.com/preetemp/try.txt");
> file_copytodir = new File(url_copytodir.getFile());
> FileUtils.copyFile(file1,file_copytodir);
> 
> However, even if I am accessing as root and preetemp and try.txt were
created by me, it says access denied!
> 
> I tried copying contents from a file in ftp to a file on the pc that im
running the application..... and that works fine!
> Is there anyway of achieving this task using FileUtils only?!
> 
> Any suggestions?
> thanks
> Preetham
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


NOTICE: This communication contains information which is confidential to
Realm Business Solutions, Inc. or its subsidiary ("Realm"). If you are not
the intended recipient of this communication, please delete and destroy all
copies. If you are the intended recipient of this communication, you should
not copy, disclose or distribute this communication without Realm's
authority. Any views expressed in this communication are those of the
individual sender, except where the sender specifically states them to be
Realm's views. Except as required by law, Realm does not represent, warrant
or guarantee that the integrity of this communication has been maintained
nor that the communication is free of errors, virus, interception or
interference.

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message