Welcome to the SRP Forum! Please refer to the SRP Forum FAQ post if you have any questions regarding how the forum works.
Utility RENAMEFILE
We have a user that sporadically has the following code fail to rename a file. Anyone else ever seen anything like this? The user is running OI using RDP. Test_Dir is passed to the below code and does not change.
Err = ""
Test1_File = Test_Dir:"test1"
Test2_File = Test_Dir:"test2"
Test_Handle = ""
OsWrite "" To Test1_File
OsOpen Test1_File To Test_Handle Then
OsClose Test_Handle
Call Utility('RENAMEFILE',test1_File,test2_File)
OsOpen Test2_File To Test_Handle Then
OsClose Test_Handle
End Else
Err = 1
Call Errx(10332, Test_Dir); * Unable To Rename File In ":Test_Dir:" Check Your Access Rights
End
OsDelete Test2_File
End Else
Err = 1
Call Errx(10333, Test_Dir); * Unable To Create File In ":Test_Dir:" Check Your Access Rights
End
Return Err
Err = ""
Test1_File = Test_Dir:"test1"
Test2_File = Test_Dir:"test2"
Test_Handle = ""
OsWrite "" To Test1_File
OsOpen Test1_File To Test_Handle Then
OsClose Test_Handle
Call Utility('RENAMEFILE',test1_File,test2_File)
OsOpen Test2_File To Test_Handle Then
OsClose Test_Handle
End Else
Err = 1
Call Errx(10332, Test_Dir); * Unable To Rename File In ":Test_Dir:" Check Your Access Rights
End
OsDelete Test2_File
End Else
Err = 1
Call Errx(10333, Test_Dir); * Unable To Create File In ":Test_Dir:" Check Your Access Rights
End
Return Err
Comments
The strange thing is this code works on every install we have and only intermittently fails on this one machine.