Hello all,
I have written a program with Windows Forms and C# to create Backups from all connected controllers on the Network. The tool works great with IRC5-Controllers, but when there’s an Omnicore-Controller, I get an Error-Message during copying a temp-File from the Controller to the local Machine.
How do I create a Backup:
- Create a temporary Directory for the Backup on the Controller (maybe unneccessary?)
- Create the Backup into this directory
- Copy the directory from the controller to the local machine (I use the function GetDirectory)
- Remove the directory and all files in it from the controller (I just want the Backup to be on my Computer)
My temporary path looks like this:
tempPath = “Backup_in_progress”;
And the Backup-Steps are the following (Mastership is granted):
[…]
//Create temporary directory on controller
if (c.FileSystem.DirectoryExists(tempPath))
{
c.FileSystem.RemoveDirectory(tempPath, true);
c.FileSystem.CreateDirectory(tempPath);
}
//load backup into temp Directory
c.Backup(tempPath);
//Wait until Backup finished
try { while (c.BackupInProgress) { Thread.Sleep(100); } }
catch(Exception e)
{
Invoke((MethodInvoker)delegate
{
statusLabels![i].BackColor = Color.Red;
statusLabels[i].Text = e.ToString();
});
c.Logoff();
continue;
}
//Copy temporary Directory to local Computer…
c.FileSystem.GetDirectory(tempPath, path, true); ← At this point I get the Error
//…and remove it from the controller
c.FileSystem.RemoveDirectory(tempPath, true);
[…]
The Error-Message is the following:
System.IO.DirectoryNotFoundException: “ctrl:C:/Users/obs/Documents/RobotStudio/Virtual Controllers/P2064_R03/HOME/Backup_in_progress”
I tried to add the “ctrl:” before my tempPath, but this wouldn’t work. Also I tried to use this as tempPath: “(BACKUP)$/backup_in_progress”, but this didn’t work either.
And just as reminder: On IRC5 it worked perfectly (RC and VC).
Edit: I tried further and I found, that the GetDirectory-function tries to open directories from the HOME-Folder on the Controller. How can I open Directories from the root directory, where the BACKUP-Folder sits?