Backup PC SDK Problem
Newbe
✭
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
Newbe2009-10-14 07:46:57
0
Comments
-
Hi ,File System on Real Controller is not same as on PC( Windows)You need to mention the Backup directory name. e.g "MyBackup"now use thisBackupDir="ctrl:(BACKUP)$/MyBackup"Regards
Saleem Javed0 -
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:
BackupDir = "ctrl:c:/BACKUP/NewBackup"
controller.Backup(BackupDir)
which would cause the folder NewBackup to be created in the folder BACKUP and all the controllers backup information would go in that folder? right?
Newbe2009-10-14 07:47:100 -
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:1) Create a backup on the controller using Controller.Backup(string path)2) Wait until backup is completed using Controller.BackupInProgress property3) Send the folder with backup to the desired location on your PC using Controller.FileSystem.GetDirectory(string remoteDirectory, string localDirectory).4) If necessary you can delete the backup from the controller using Controller.FileSystem.RemoveDirectory(string path)1
-
thank you for the response...can you give a example of what the string for remoteDirectory and LocalDirectory would look like please?
0 -
Ok lets say we want to create a backup from the controller on our computer at C:Temp in a folder named BACKUP.1) 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".2) 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.Controller.FileSystem.GetDirectory("TestBackup", "C:\Temp\BACKUP")This will copy the backup from the controller to the computer at C:TempBACKUP.You should add some checks to check if directories exist and else you should create them.0
-
Thanks KSP I will give that a try today and post back my results
0 -
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.
0 -
Ok...I figured it out...so I needed to set the RemoteDirectory to the full path before I made the call to RemoveDirectory
Example
controller.FileSystem.RemoteDirectory() = "/hd0a/66-59720/HOME"
controller.FileSystem.RemoveDirectory(BackupDir, True)
This works fine on a real controller...
0 -
Hi,
I am attempting to do the same thing but when ever i try and use the GetDirectory function I throws the exception;
{"Operation is not valid due to the current state of the object."}
Any idea what is causing this? Both remote and local directories are set correctly.0 -
I am also have this problem:when ever i try and use the GetDirectory function I throws the exception;
{"Operation is not valid due to the current state of the object."}Any idea what is causing this? The Sourcepath is on an virtual maschine in my case.
0 -
Hello,
Maybe if you share a snippet of you code we can provide some assistance.
—Nils OlofssonPC Software Support Engineer0 -
Hi NilsI'm trying to copy directory BACKUP from C:/Users/danie/Documents/RobotStudio/Virtual Controllers/AE_Rob1_V06/HOME/BACKUP_230621"
to local directoy /Temp/BACKUP";
//string sbackupDir = "(BACKUP)$" + aController.SystemName + "_" + sDatum;
string sbackupDir ="BACKUP_" + sDatum;
string sBackupDirPath= @C:/Users/danie/Documents/RobotStudio/Virtual Controllers/AE_Rob1_V06/HOME/BACKUP_230621;
string sPCStoreDir = @D:/Temp/BACKUP;
string sRemotebackupDir = aController.FileSystem.RemoteDirectory + "/" + sbackupDir;
Console.WriteLine("st_RobotDirectoryPath {0}", aController.FileSystem.RemoteDirectory); // is set to HOME-Dir in system dir
Console.WriteLine("sRemotebackupDir {0}", sRemotebackupDir);
aController.FileSystem.LocalDirectory = sPCStoreDir;
//aController.FileSystem.PutFile("test.txt"); //this works. put the file from /Temp/BACKUP into HOME-Dir of Robot
//aController.FileSystem.GetFile("test2.txt"); //this works. get file from HOME-Dir into /Temp/BACKUP
//
//This will copy the backup from the controller to the computer at /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?Thank you!Daniel
0 -
daniel72
it seems as the Boolean argument wont succeed with the overwrite of the existing directory. Let me get back to you on that.
If you make sure that the directory does not already exist on the PC, does it work then?—Nils OlofssonPC Software Support Engineer0
Categories
- All Categories
- 5.5K RobotStudio
- 396 UpFeed
- 18 Tutorials
- 13 RobotApps
- 297 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 250 ScreenMaker
- 2.8K Robot Controller
- 316 IRC5
- 61 OmniCore
- 7 RCS (Realistic Controller Simulation)
- 798 RAPID Programming
- AppStudio
- 3 RobotStudio AR Viewer
- 18 Wizard Easy Programming
- 105 Collaborative Robots
- 5 Job listings