Skip to Content
0

How to get the count of files in a directory in BODS

Dec 05, 2017 at 01:26 PM

249

avatar image

Hi Experts,

I have a scenario, we need to get the count of files in a directory and load it into a variable,Please suggest me is there any in-built function available in BODS or any work around for that

Thanks in Advance.........!

Best Regards,

Sudheer.M

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Best Answer
avatar image
Former Member Dec 05, 2017 at 01:59 PM
0

Create a batch job in data services designer and declare the following global variables: $file_names - varchar(1000), $FILE_COUNT - int, . Create a script as follows:

wait_for_file('C:\Program Files (x86)\SAP BusinessObjects\Data Services\dsdata\*.txt', 1, 1, -1,$file_names, $FILE_COUNT,',');

print('Number of file found = ' || $FILE_COUNT);

print('File names = ' || $file_names);

The script shows an example of where to look for the files. You can change it according to your system. In this case it looks for all text files in the folder: C:\Program Files (x86)\SAP BusinessObjects\Data Services\dsdata. You can mention your path. file names will be printed with comma separated.

Share
10 |10000 characters needed characters left characters exceeded
NAGA SUDHEER MAKINENI Dec 06, 2017 at 05:34 AM
0

Hi Jayasree,

Thanks for your quick response, We already have some files in the folder so we need to get the count of the files and names of the files, So that we will process those files accordingly.Please give me is there any other way to get the information for already exist files.

Best Regards,

Sudheer.M

Share
10 |10000 characters needed characters left characters exceeded
NAGA SUDHEER MAKINENI Dec 06, 2017 at 12:46 PM
0

Hi Jayasree,

Thanks, Its working i can able to get the count by using wait_for_file function as suggested by you. It satisfies my requirement.

Best Regards,

Sudheer.M

Share
10 |10000 characters needed characters left characters exceeded