mrd
mrd

Reputation: 2183

Change path before executing "SITE P_DEST" FTP command in WinSCP

Is it possible to change path in WinSCP? I know session.PutFile(fileStream, '/general/incoming/Test.zip') will write file at path mentioned. But when I try with command

CommandExecutionResult result = session.ExecuteCommand("SITE P_DEST KOMM@TEST");

It always have destination /general/ (It is session.HomePath). Following is from session log:

<command value="SITE P_DEST KOMM@TEST" />
      <destination value="/general" />

Wonder is it possible to change path before executing command? I want to change path to /general/Incoming

Upvotes: 1

Views: 330

Answers (1)

Martin Prikryl
Martin Prikryl

Reputation: 202168

WinSCP .NET assembly does not use the concept of a working directory. It always uses absolute paths, as explained here:
Change root SFTP directory using the WinSCP .NET assembly

So when using the WinSCP API, you never need to change the working directory.


But ok, you are not using WinSCP API. You are seem to be trying to execute some proprietary command SITE P_DEST of your FTP server. You didn't tell us anything about that command. I do not know, what that does it do.

Let's guess that maybe your command works with FTP working directory. It seems that it connects somewhere. So I do not see, what does it have to do with a working directory. If it does, first make sure there's no way to tell the command, that it should use a different folder than the working directory. All standard FTP commands can do that.

If not, you can try to use CWD /the/path before SITE P_DEST.

Upvotes: 3

Related Questions