Menu

#8 PWD Functionality

open
nobody
None
5
2007-05-18
2007-05-18
open-collar
No

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;
}

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.