PC SDK "GetDirectory" problem

Hi All,

Basic concept is to creat a backup on the flexpendent controller and the copy that directory to the local HDD of the PC that is running the SDK but I keep having a problem getting the “CopyDirectory” or “GetDirectory” methods to work!

My Code:
//string st_BackUp = this.controller.SystemName;
string st_BackUp = this.controller.SystemName + “_TEST”;
string st_RobotDirectoryPathCk = (“”);
string st_folderName = “C:\TEMP_NS”;
string st_RobotDirectoryPath = “”;
string st_LocalBackupPath = Path.Combine(st_folderName, st_BackUp);

//Create string for comparision between path name methods
st_RobotDirectoryPathCk = this.controller.FileSystem.RemoteDirectory;

// Create second controller directory path string using different method
st_RobotDirectoryPath = controller.GetEnvironmentVariable(“HOME”) + @“/”;

string st_RobotBackupPath = (st_RobotDirectoryPath + “/” + st_BackUp);

// Display path
MessageBox.Show("current Robot Directory is set to: " + st_RobotDirectoryPath);

MessageBox.Show("current Robot Directory check is set to: " + st_RobotDirectoryPathCk);

//Create backup in HOME or BACKUP directory with system name.
this.controller.Backup(st_BackUp);
while (this.controller.BackupInProgress)
{
MessageBox.Show(“Backup In progress”);
}

MessageBox.Show(“Backup complete”);

// Create directory on local system and copy backup to that location.
Directory.CreateDirectory(st_LocalBackupPath);
this.controller.FileSystem.GetDirectory(st_RobotBackupPath, st_LocalBackupPath);

I Have tried writing the file paths but stll have the same problem.

error message when running “GetDirectory”: “Operation is not valid due to the current state of the object”

Any help appreciated,

Running RS 5.15.02, VS2010 C# Express.