PWD Functionality
Brought to you by:
boudartjj
You don't seem to have a function for retrieving the remote current directory. Here it is:
public virtual string GetCurrentDirectory()
{
LockTcpClient();
System.Collections.ArrayList tempMessageList;
int returnValue;
tempMessageList = SendCommand("PWD");
returnValue = GetMessageReturnValue((string)tempMessageList[0]);
if(returnValue != 257)
{
throw new System.Exception((string)tempMessageList[0]);
}
string directory = (string)tempMessageList[0];
// The message is formatted: 257 "/<path>" is current directory.
int quoteIndex = directory.IndexOf('"', 5);
directory = directory.Substring(5, quoteIndex - 5);
UnlockTcpClient();
return directory;
}