commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "pam withnall" <pwithn...@team.tedis.biz>
Subject RE: using FTPClient send Command - upper case used?
Date Tue, 31 May 2005 01:50:10 GMT
I thought that might have been the case,
I found that rexec worked manually, so that I also tried

			RExecClient rec = new RExecClient();
			rec.connect(host);
			assertTrue("Is not connected to " +
host,rec.isConnected()); // yes , its JUnit
			NonWebUtils.log("Is connected to " + host);
			rec.rexec(login,pwd,command);
			rec.disconnect();

But, I don't think it worked.
Is there a sample for this, to get feedback from the server?
Ta.

> -----Original Message-----
> From: Kurniawan Kurt [mailto:kkurnia@bigw.com.au] 
> Sent: Tuesday, May 31, 2005 11:39 AM
> To: Jakarta Commons Users List
> Subject: RE: using FTPClient send Command - upper case used?
> 
> 
> 
> You can only send a specific command as listed in the doc.
> 
> Pls have a look at the API doc:
> 
> org.apache.commons.net.ftp.FTPCommand
> 
> 
> So if you do:
> 
> ftp.sendCommand("list");
> 
> it should work. Your command is not a valid FTP command.
> 
> If you want to execute a remote command to UNIX you have to 
> use RCommandClient()
> 
> Please again read the API doc. It explains to you how to use 
> it. Make sure you can make this work with your normal command 
> (using rsh). You need permission to be set in the .rhost file 
> and you need to be valid user in the box. Please talk to your 
> UNIX admin for this details. They should understand how to setup rsh.
> 
> Good luck !
> 
> 
> Kurt Kurniawan
> 
> 
> -----Original Message-----
> From: pam withnall [mailto:pwithnall@team.tedis.biz]
> Sent: Tuesday, 31 May 2005 10:55 AM
> To: 'Jakarta Commons Users List'
> Subject: RE: using FTPClient send Command - upper case used?
> 
> 
> Ok, I'll send you the code and the reply.
> I send lower case and even added toLowerCase() , 'just in 
> case', But the server thinks its uppercase "Unknown command EDISEND" .
> 
> ****************code*********************
> 			System.out.println("Current working directory "
> + ftp.printWorkingDirectory());
> 			System.out.println("Doing command " + command);
> 			int result =
> ftp.sendCommand(command.toLowerCase());
> 			System.out.println("result of command " +
> command + "  is :" +result);
> 			System.out.println(new 
> Integer(ftp.getReplyCode()).toString());
> 			System.out.println(ftp.getReplyString());
> 
> *****output********************
> Current working directory /data/tradexpress/users/onestop/tmp/edifact
> Doing command edisend dispatch_UBM_EB
> result of command edisend dispatch_UBM_EB  is :500
> 500
> 500 Unknown command EDISEND  
> 
> ***********************************
> 
> > -----Original Message-----
> > From: Kurniawan Kurt [mailto:kkurnia@bigw.com.au]
> 
> > Sent: Tuesday, May 31, 2005 10:29 AM
> > To: Jakarta Commons Users List
> > Subject: RE: using FTPClient send Command - upper case used?
> >
> 
> >
> 
> >
> 
> > Hi,
> >
> 
> > Can you give more explanation of what do you want to do with
> 
> > yours ? I use HP-UX as my server, never have this problem.
> >
> 
> >
> 
> > If the return is uppercase, you should be able to change the
> 
> > String returned to uppercase easily. with toUpperCase() ? if
> 
> > the command is lowercase you can change with toLowerCase() ?
> >
> 
> >
> 
> >
> 
> > Kurt Kurniawan
> >
> 
> >
> 
> > -----Original Message-----
> > From: pam withnall [mailto:pwithnall@team.tedis.biz]
> > Sent: Tuesday, 31 May 2005 10:08 AM
> > To: commons-user@jakarta.apache.org
> > Subject: using FTPClient send Command - upper case used?
> >
> 
> >
> 
> > Hi,
> > My main objective is to run some Unix commands on a remote
> 
> > server. As I am already using commons.net.FTPClient to move
> 
> > some files, I saw the method sendCommand(String). I used
> 
> > getReplyString to find out what was happening, and my server
> 
> > couldn't find the command because it was in upper case!
> >
> 
> >
> 
> > I also tried  RExecClient.rexec(login,pwd,command);
> > but cannot see that it is working.
> > Thanks. Pam.
> >
> 
> >
> 
> >
> 
> >
> 
> >
> 
> >
> 
> >
> 
> >
> 
> >
> 
> >
> 
> >
> 
> > CAUTION: This email and files included in its transmission
> >
> 
> > are solely intended for the use of the addressee(s) and may
> >
> 
> > contain information that is confidential and privileged.
> >
> 
> > If you receive this email in error, please advise us
> >
> 
> > immediately and delete it without copying the contents
> >
> 
> > contained within. Woolworths Limited (including its group
> >
> 
> > of companies) do not accept liability for the views
> >
> 
> > expressed within or the consequences of any computer
> >
> 
> > viruses that may be transmitted with this email. The
> >
> 
> > contents are also subject to copyright. No part of it
> >
> 
> > should be reproduced, adapted or transmitted without the
> >
> 
> > written consent of the copyright owner.
> >
> 
> > 
> ---------------------------------------------------------------------
> > 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
> 
> 
> CAUTION: This email and files included in its transmission
> 
> are solely intended for the use of the addressee(s) and may
> 
> contain information that is confidential and privileged.
> 
> If you receive this email in error, please advise us
> 
> immediately and delete it without copying the contents
> 
> contained within. Woolworths Limited (including its group
> 
> of companies) do not accept liability for the views
> 
> expressed within or the consequences of any computer
> 
> viruses that may be transmitted with this email. The
> 
> contents are also subject to copyright. No part of it
> 
> should be reproduced, adapted or transmitted without the
> 
> written consent of the copyright owner.
> 
> ---------------------------------------------------------------------
> 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