Read File Name from Folder of Linux Operating System

w2vijay

w2vijay

Well Known Member
Hello Guys,

We have a requirement to read file names one by one from list of files present in a folder and process them. The operating system would be linux operating system. Does anyone has implemented similar requirement or any idea on how to accomplish this requirement.

In oracle metalink found the below comments but not sure how to get solution from this.

-----------------------------------------------------------------------------------------------------
EnterpriseOne does not have any API to get or list filename of files in a folder, however JDE can execute native operating system command. If you have native operating system command that get filenames and insert into a JDE table or flat file, JDE interactive app and UBE can then read from the JDE table or flat file.

The business function that can execute native os command is B34A1030, please review this document
-----------------------------------------------------------------------------------------------------

Many thanks for the help and let me know if more details are needed.
 
You can do this with a custom C BSFN. I have done this for a Windows environment, not on Linux, but the concept should be the same. For Windows at least the API calls are OS specific and I would assume the same would be true for Linux. You will either need to make your BSFN a server only call or more likely put some pre-compiler directives to do a conditional compile for either Linux or Windows (and any other OS you wish to support).

Pseudo code example:
Note: I am using compiler defines as an example which should work but to conform to JDE coding guidelines you should probably use JDE's OS defines.
Code:
#ifdef _MSC_VER						/* MS VC++ compiler */
MyGetListOfFilesFunc
{
	....
	struct _finddata_t  fileInfo;
	...
	findHandle = _findfirst(pzFileSpec, &fileInfo);
	...
	bFound = _findnext(findHandle, &fileInfo) == 0;
	...
}
#elif defined (__GNUC__)			/* Linux GCC Compiler */
MyGetListOfFilesFunc
{
	//linux api calls... whatever those might be
}
#endif
 
Back
Top