RobotStudio event

Backup path is not changed even if remotePath is

Options
Hi, i'm developing an utility for my company to manage the robots we have,
i'm having problems with backup code :

var destinationPath = "2019_10_10";
                if (!this.isConnected)
                {
                    this.Connect();
                }
                Console.WriteLine(_ctrl.FileSystem.RemoteDirectory);
                _ctrl.FileSystem.RemoteDirectory = "/hd0a/BACKUP";
                Console.WriteLine(_ctrl.FileSystem.RemoteDirectory); <-- used this only for be sure that RemoteDirectory is changed
                if (!Directory.Exists(Path.Combine(localPath, DateTime.Now.ToString("dd-MM-yyyy"), Info.ControllerName)))
                {
                    Directory.CreateDirectory(Path.Combine(localPath, DateTime.Now.ToString("dd-MM-yyyy"), Info.ControllerName));
                }
                _ctrl.BackupCompleted += (object e, BackupEventArgs evt) =>
                {
                    Console.WriteLine("Backup over");
                };
                _ctrl.Backup(destinationPath);

But even if i've specified /hd0a/BACKUP as remoteDirectory my backups are always made inside HOME... 
Any suggestions ? 
Tia

Comments

  • Micky
    Micky ✭✭✭
    Options
    Hello Tia,

    please try the following:
    _ctrl.FileSystem.RemoteDirectory = _ctrl.GetEnvironmentVariable("Backup");
    or 
    _ctrl.FileSystem.RemoteDirectory = "(Backup)$";

    or if you want to address the path on the controller you have to add "ctrl:":

    _ctrl.FileSystem.RemoteDirectory = "ctrl:/hd0a/Backup";

    The two upper versions also work on the virtual controller

    Best regards
    Micky