RobotStudio event

No privileges to delete a file

Options

Hi,

i have written a routine to read a file  by using the filestream. first i do acopy from remote to local system. Then i read the files content.

After that i want to remove the file from the local system using the following command:


CtrlABBRobot.FileSystem.GetFile(strRemoteIniFile, strLocalIniFile);
Do the work here...
CtrlABBRobot.FileSystem.RemoveFile(strLocalIniFile);

This results always in an error which tells me somethin gof isufficient privileges.

What do i do wrong?

Thanks ahead.

 

 

Comments

  • RussD
    Options

    According to the documentation, RemoveFile only works on the robot controller (Remote) file system.

    There are a couple of alternatives you might consider:

    1. If the file is not too large, you can leave it and it will be cleaned up the next time the FlexPendant restarts. This will happen because each restart reloads the same OS image.

    2. If you will execute your routine several times during a single FlexPendant session, you can use the GetFile command to rename your file to the same name, which from my experience will always overwrite the existing file. This way, you can take advntage of point number 1 above.

    Russell Drown
  • Hi Russell,

    this is a little bit confusing, even if this works...

    In the first try, i wanted to open the file directly in the remote directory (i.e. the home directory of the controller), which was not working correctly... Not possible to open for READING !!! Then i had to copy it to the local directory, what could result in problems if there are several files and if the files may be large...., thus it should be possible to remove them anyhow, don't you agree on that?

    br

    Thomas

  • RussD
    Options

    I agree, its not the simplest way of dealing with files.

    I believe that there are some enhancements scheduled for FPSDK 5.08 that will permit direct access to remote (flash disk) files, which should make life much simpler. Hopefully that is still the case.

    RussD2006-6-20 19:27:42
    Russell Drown
  • ycasas
    Options

    Hello Thomas,

    I destroy local copies of the files, once they are no longer necessary, with:


    System.IO.File.Delete(strFileLocalCopyPath);
    Hope this helps (it works for me!).
    Yolanda Casas