Help Using ExecuteCommand? ls is unrecognized command.

Advertisement

JeffLawlorEtna
Joined:
Posts:
1
Location:
United States

Help Using ExecuteCommand? ls is unrecognized command.

Greetings. Thanks for all the effort in creating this library!

I'm trying to run a "ls" command against a plain old FTP server and I get an exception:

Syntax error, command unrecognized.

Here's the code:

CommandExecutionResult result = _session.ExecuteCommand("ls");

I must be missing something simple here. Any advice?

I'm using the 5.07 beta of WinSCP and the assembly.

Thanks,
Jeff

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,478
Location:
Prague, Czechia

Re: Help Using ExecuteCommand? ls is unrecognized command.

There's no "LS" FTP command.

You probably wanted to use "LIST". But that won't work anyway for numerous reasons. Primary one being that for directory listing with FTP you need to open a separate channel. The listing is not part of a direct response to the LIST command.

Anyway, what's the point? There's Session.ListDirectory command:
https://winscp.net/eng/docs/library_session_listdirectory

Reply with quote

hendra
Guest

Help Using ExecuteCommand

hello sir,
please help...
according to example in this article
https://winscp.net/eng/docs/library_session_executecommand#vbnet
i've found error after waiting some time, when execute command :
Dim strtxt As String = "mysqldump -u user -p password dbase>\test.sql"
session.ExecuteCommand(strtxt).Check()
WinSCP.SessionRemoteException : Connection has been unexpectedly closed. Server sent command exit status 0. Error skipping startup message. Your shell probably incompatible with the application (BASH is recommended).

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
41,478
Location:
Prague, Czechia

Re: Help Using ExecuteCommand

Please start a new thread and attach a full session log file showing the problem (using the latest version of WinSCP).

To generate the session log file, set Session.SessionLogPath. Submit the log with your post as an attachment. Note that passwords and passphrases not stored in the log. You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you can mark the attachment as private.

Reply with quote

Advertisement

You can post new topics in this forum