I am trying to use the Backup call on a 5.12 RAB PC SDK application with a controller running 5.11.3 when I execute the code below after getting mastership of the controller I get the exception “Unable to create directory” If I use the same code on the Virtual controller running on the same PC as my application it works fine. Anybody have any Ideals why that is.
Dim BackupDir As String = “”
BackupDir = “ctrl:C:/Backup”
Try
controller.Backup(BackupDir)
Catch ex As GenericControllerException
MessageBox.Show(ex.Message.ToString, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information)
End Try
Thank you for the response but that just creates the backup on the controller in the BACKUP folder. I want the backup to be created on my PC running my PC SDK application. so I have a folder on the root of my PC’s hard drive called BACKUP and I want to create my backup of the controller in that folder so I would think the code should be:
When you create a backup on the real controller using the Controller.Backup(path) function, it stores the backup in the folder you gave as location relative to the Controller.FileSystem.RemoteDirectory folder.
Example: (Say that the RemoteDirectory is set to the HOME folder on the controller)
Controller.Backup(“TestBackup”)
This will create a backup and stores it on the controller in the HOME/TestBackup folder.
What you could do is:
Create a backup on the controller using Controller.Backup(string path)
Wait until backup is completed using Controller.BackupInProgress property
Send the folder with backup to the desired location on your PC using Controller.FileSystem.GetDirectory(string remoteDirectory, string localDirectory).
If necessary you can delete the backup from the controller using Controller.FileSystem.RemoveDirectory(string path)
Ok lets say we want to create a backup from the controller on our computer at C:Temp in a folder named BACKUP.
Create a backup at the real controller using the Controller.Backup(string path) function:
The RemoteDirectory property of Controller.FileSystem is set to the HOME folder of the controller ( “/hd0a/14M-51688/HOME” ) were 14M-51688 is the name of my controller. And the path you give to the Backup function is relative to the RemoteDirectory property, so:
Controller.Backup(“TestBackup”);
while (Controller.BackupInProgress) { }
This will create the backup in the following folder “/hd0a/14M-51688/HOME/TestBackup”.
Copy the folder containing the backup from controller to computer:
The remote directory is again relative to the RemoteDirectory so you can give the same folder as you gave to the Backup function.
Hello KSP,
Wanted to let you know that the backup on the controller and then using the GetDirectory works fine. The problem is that the RemoveDirectory does not work.
Here is the code for the button_click:
Dim BackupDir As String = “MyBackup”
controller.Backup(BackupDir)
Here is the code for the BackupCompleted Event:
Dim BackupDir As String = “MyBackup”
controller.FileSystem.RemoveDirectory(BackupDir)
below is the error that I get. I do have Mastership of the controller. Any help that you or anybody else could offer would be great.
I’m trying to copy directory BACKUP from C:/Users/danie/Documents/RobotStudio/Virtual Controllers/AE_Rob1_V06/HOME/BACKUP_230621"
to local directoy D:/Temp/BACKUP";
Console.WriteLine(“st_RobotDirectoryPath {0}”, aController.FileSystem.RemoteDirectory); // is set to HOME-Dir in system dir
Console.WriteLine(“sRemotebackupDir {0}”, sRemotebackupDir);
//aController.FileSystem.GetFile(“test2.txt”); //this works. get file from HOME-Dir into D:/Temp/BACKUP
//
//This will copy the backup from the controller to the computer at D:/Temp/BACKUP
aController.FileSystem.GetDirectory(sBackupDirPath, sPCStoreDir,true); //Exeption: “Directory is not empty”
aController.FileSystem.GetDirectory(sBackupDirPath, sPCStoreDir,false); //Exeption: "Operation is not valid due to the current state of the object
aController.FileSystem.GetDirectory(sBackupDir, sPCStoreDir,false); //Exeption: "Operation is not valid due to the current state of the object
Which path specifications does GetDirectory expect - Absolute or relative to FileSystem.RemoteDirectory?
I’ve tried both variants
I read in another post that you should set FileSystem.RemoteDirectory again before GetDirectory. But what, is it still on HOME?