sachinms
21st December 2005, 11:41
I am developing an interface program. After updating data from an ASCII file, I need to delete this file from the Baan server.

I am using the file.rm function to delete this file, however it returns a value -1 and does not delete the file. The operating system is Windows 2000 server.

I will appreciate if somebody can please explain the error and suggest a solution to delete the file.

Thank you

beginer
21st December 2005, 11:47
Hi ,

Hope u are giving the complete path of the file.
You can get the error code by fetching the value of predefined variable "e".
This will help u in getting more closer to the error.

bdittmar
21st December 2005, 12:00
I am developing an interface program. After updating data from an ASCII file, I need to delete this file from the Baan server.

I am using the file.rm function to delete this file, however it returns a value -1 and does not delete the file. The operating system is Windows 2000 server.

I will appreciate if somebody can please explain the error and suggest a solution to delete the file.

Thank you

Hello,

BaanERP Programmers Guide


file.rm()

--------------------------------------------------------------------------
Syntax
long file.rm( const string path )

Description
This deletes a specified local or remote file. The path argument must include the full path to the file, including the host name, where appropriate. For example: "host!/usr/myfile".

Return values
1 Success.

<0 Error.


Context
Bshell function.


Regards

JaapJD
21st December 2005, 12:37
Check whether you closed the file before deleting it (seq.close).

sachinms
21st December 2005, 12:51
Yes, I am giving the full path as the argument. This program works in UNIX i.e. it deletes the file, however it does not delete the file on Windows platforms?

Do we have an explanation of what error -1 is?

JaapJD
21st December 2005, 13:00
It is indeed a difference between Windows and Unix that in Windows you cannot delete a file which is not closed. In Unix you can.

george7a
21st December 2005, 13:20
Hi,

You can use move.file() (in filehand dll)to cut the file and put it in the $BSE/tmp/tmp.tmp. every file you want to delete a file, move it to the $BSE/tmp under the same name "tmp.tmp"

Read about move.file here http://www.baanboard.com/baanboard/showthread.php?t=1597&highlight=move.file
check the attached txt file in post #7

I hope it helps,

- George

jclju1
21st December 2005, 15:52
Do we have an explanation of what error -1 is?

Could be "not owner". Did you check your permissions for this file?

NPRao
21st December 2005, 20:41
Do we have an explanation of what error -1 is?

SSA ERP LN 6.1 Programmers Guide
file.rm()
--------------------------------------------------------------------------------
Syntax long file.rm( const string path )

Description This deletes a specified local or remote file. The path argument must include the full path to the file, including the host name, where appropriate. For example: "host!/usr/myfile".

Return values =0 Success.
<0 Error. The error code is stored in the e variable.

Context Bshell function.

SSA ERP LN 6.1 Programmers Guide
1 EPERM - Not owner
--------------------------------------------------------------------------------
Description: This error indicates an attempt to modify a file that cannot be modified, except by its owner or a super user. This error also appears when ordinary users attempt actions allowed only to the super user.
Solution:
Possible solutions are:
If this is a program errror, contact Baan Company. If you do so, have the session name in which the error occurred, available. Also, make a screen dump of the error messages and the relevant part of the log file.
If you are using a UNIX operating system, change the permissions, owner or group of a file or directory.
If you are using a Windows NT operating system, ...............................

Yes, I am giving the full path as the argument. This program works in UNIX i.e. it deletes the file, however it does not delete the file on Windows platforms?
Your profile says your OS is both UNIX and Windows. We have upload programs where the input files are on the local Windows system, the file is transferred to Unix directory. I hope you are not trying to delete the client file using file.rm(), you have to use remove.local.file().

sachinms
4th January 2006, 16:36
Thank you for all the help, it worked.

Following is our observation:

When working on Windows platform we need to first close the file before deleting the file using the file.rm command.

However one need not close the file before deleting the file using the file.rm command when working on Unix platforms.