spartacus
22nd February 2007, 13:33
Hi all,

we use "xmlWrittePretty()" to write our data as xml-structure to a file (of course). We use "sendmail", to send that file via email to some users.

Due to the fact, that email-size is limited on our system, we have to check the filesize.

Is there any quick an easy way to determine the size of the resulting file, before we use "xmlWrittePretty()"?

From my point of view, the only way to get the file-size is:
1. create the xml-file from Baan
2. send a "shell()"-comand with "ls -l" or "du -k", and write the output of the unix-command to a file.
3.read the above created file.


It will be great if someone has a better idea ;-)

csecgn
22nd February 2007, 16:32
Just for step 2 and 3. You can use file.stat(...) instead of the shell script.


Syntax

long file.stat( string file_name(256), ref long file_size [, ref long ctime, ref long mtime, ref long atime ] )

Description

This returns information about a specified file. It is a short version of the stat.info() function.

Arguments

file_name The name of the file for which information is required.
file_size The file size in bytes.
ctime The time when the file status was last changed, as a number of seconds since 00:00:00 GMT, January 1, 1970.
mtime The time when the file was last modified, as a number of seconds since 00:00:00 GMT, January 1, 1970.
atime The time when the file data was last accessed, as a number of seconds since 00:00:00 GMT, January 1, 1970.

Return values

0 file exists
<>0 operating system error code


hth

Regards
Christof

spartacus
22nd February 2007, 17:13
Hi Christof,

thanks, good idea. I forgot file.stat() totaly. Think I stuck in shell commands. I used file.stat() once some years ago. With this function things will be much more smooth :D


regards