AlluRajasekhar
10th October 2008, 12:25
Hi All,

I am trying to get a list of files on a particular directory on Baan Server to a ascii file. The problem is I will have to do it in a script. I have tried using app_start amd run.prog. But with no success. Following is what I have tried...

ret = run.prog("/home/arajasek", "ls > process.file", "rp_wait)

But it always returns "-1"

Basically I will have to process list of files in a particular directory. Hence I am planning to write all these file names in an ascii file called Process.files. I would then open this process.files and then start processing each file.

Appreciate any help on this.

Thank you.

george7a
10th October 2008, 13:11
Hi,

app_start is for starting an application on the client. Try to use the shell function (http://www.baanboard.com/programmers_manual_baanerp_help_functions_starting_and_stopping_programs_shell), it should work on UNIX.

However, if you are trying to get a list of files, you might be interested in the dir.open() (http://www.baanboard.com/programmers_manual_baanerp_help_functions_directory_file_operations_dir_open) & the other related functions.

I hope it helps,

- George

_Ralph_
10th October 2008, 17:36
Hi All,
ret = run.prog("/home/arajasek", "ls > process.file", "rp_wait)

But it always returns "-1"


If this is your real code it is wrong.

This one should work


long ret
domain ttaad.path ls.path |The command will be executed
domain ttaad.path file.dir|The file will be saved

|* Use to be /home/youlogin
ls.path = getenv$("HOME")
|* Most of cases $BSE/tmp/ls_yourlogin

file.dir = trim$(bse.tmp.dir$()&"/ls_"&logname$&)
ret = run.prog(ls.path, "ls", RP_WAIT, "", file.dir)


Worked well here =)

regards

NPRao
10th October 2008, 20:43
Refer to the thread - opening and reading a file from a directory on the server (http://www.baanboard.com/baanboard/showthread.php?t=7414)
dir.open() makes it platform independent than the posted code.

AlluRajasekhar
13th October 2008, 13:43
Dear All,

Thank you for your suggestions. I got the solution with dir.open functions.