Finding File Names in a folder

Lucky.2811

Active Member
Hi List,

I am trying to list all file names in a folder using below BSFNs. Although the first BSFN (Find First File Matching Wildcard) retrieves the file handle the consecutive BSFN is not fetching file name. Not sure if I am missing something here. For now I am testing this in local fat client. It is Windows operating system. I expected these BSFNs to work on Windows but unfortunately not working for me. Any help would be appreciated.


Sample code looks like this

evt_szRecord_APTA
evt_CDHandle
evt_TargetDirectory
OPT: Using Defaults
0001 VA evt_TargetDirectory = "C:\NPN"
0002 Find First File Matching Wildcard
VA evt_CDHandle <> BF hFile
VA evt_TargetDirectory -> BF szTargetDirectory
VA evt_szRecord_APTA <- BF szFileName
0003 Find Next File Matching Wildcard
VA evt_CDHandle <> BF hFile
VA evt_szRecord_APTA <- BF szFileName
0004 Find Next File Matching Wildcard
VA evt_CDHandle <> BF hFile
VA evt_szRecord_APTA <- BF szFileName
 

peterbruce

Legendary Poster
Lakshmi,

I don't think I've ever used these business functions before, but where is the actual wild card? I'm guessing that it is finding only one file (or directory/folder) and that is C:\NPN.

I would have thought that the value for VA evt_TargetDirectory would have been "C:\NPN\*"
 

saikiran

Active Member
Yes......It needs to have a wild card in the target directory to search for the files.

Also note that it is a client only BSFN.
 

Lucky.2811

Active Member
Thank you peter and Saikiran.

I did put wild card as suggested. It worked but the first BSFN is fetching . as first file name, and then the second file is coming as .. and then I am getting real file names. Any insights on this?

File names are fetched as below

.
..
TEST1.txt
TEST2.txt
TEST3.txt
TEST4.txt
TEST5.txt
 
Top