learner
30th November 2010, 19:48
Hi,

I have a session on which i am asking for a dir path, my session should be able to looks into this dir and return all the file names for the files present in this user specified dir.

How can i achieve this ??

One option which i thought was to write a simple shell command that can be executed and it can write the output of ls -ltr into a tmp file and then i can read the contents of tmp file, but i am trying to identify a better solution like directly through some baan function if i can get the list of files sitting in dir.

Is there a standard function to do this ? I went through dir related functions but looks like there is no such direct function .

-Learner

BaanInOhio
30th November 2010, 20:46
Isn't this what the 'dir' functions are used for?

dir.open() defines the directory path. dir.open.tree() is similar except that sub-directories are also processed.

dir.entry() returns each file name in the directory(s). Use the arguments to determine what types of files to return (files, directories, read/write/execute, etc). Calls to dir.entry() in a loop can provide a list of all files, until the returned string from dir.entry() is blank (indicates completion).

dir.close() to finish the process.

Works good on the Baan server. More difficult to do the same in a client directory.

learner
30th November 2010, 22:24
Thanks a lot , it worked. Somehow i missed looking at dir.entry function

-Learner