Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
8k views
in Java FTP by (400 points)
I'm trying to use
executeCommand
defined in
FTPClientInterface
to send simple ftp commands, such as: dir, help, ls, etc. I realize that there are methods for those commands specifically, but I would like to be able to execute and arbitrary command.

In short I'm looking for the behavior of
executeCommand
when connected to SFTP

Am I looking in the wrong place?

6 Answers

0 votes
by (162k points)
executeCommand is available for SFTP, although you need to be careful to use the commands supported by the server.
0 votes
by (400 points)
I'm aware of that, as I specified in my original post, the code block makes it difficult to read and I apologize for that.

I'm looking for a way to accomplish this with FTP and possibly FTPS.
0 votes
by (162k points)
Ah. In FTP/FTPS, there is site commands or you can quote a command.

However most FTP servers won't support the commands you want. It will depend very much on the individual server what it permits.
0 votes
by (400 points)
What do you mean by quoting?

I've tried the following, without any luck:
ftpclient.executeCommand( "\"dir\"" ) 


I'm using FileZilla server in my testing, and I'm pretty sure it has a "dir" command. I've tried using SITE commands, also without any luck.

Do you have any examples of sending arbitrary FTP commands? Any help is greatly appreciated.
0 votes
by (162k points)
I'm using FileZilla server in my testing, and I'm pretty sure it has a "dir" command. I've tried using SITE commands, also without any luck.

Do you have any examples of sending arbitrary FTP commands? Any help is greatly appreciated.


I'm not aware of Filezilla supporting a 'dir' command.

You could try sending HELP SITE to see if the server returns anything, i.e.

ftpclient.executeCommand( "HELP SITE" )

That may tell you what SITE commands are supported.

Your main problem here is that most FTP server support few if any commands like you are describing.

Here's some examples though (for ProFTPD). Look for "Supported SITE commands":

http://www.castaglia.org/proftpd/doc/co ... mands.html
0 votes
by (400 points)
Bruce, I applaud your patience :)

I believe I understand. The commands I was referring to are provided by command line ftp clients, which are different from "raw ftp commands". Thanks for putting me on the right track.

Categories

...