loop through files in folder

 

Hi,

 I'm trying to run through a number of files that are located in my FILE_COMMON directory. In this directory I have the following structure

NTOutput\Handled\
NTOutput\OrderTickets\
NTOutput\Pending\

I would like to look in the OrderTickets\ folder and show all files that are located in this folder. So I tried the following code:

      string file_name;
      long search_handle=FileFindFirst("NTOutput\\OrderTickets\\*",file_name);
      if(search_handle!=INVALID_HANDLE)
      {
         do
         {
            Print("file_name = ", file_name);
         }
         while( FileFindNext(search_handle,file_name) );
         FileFindClose(search_handle);
      }
      else
         Print("Files not found!");

Unfortunately this gives me a File Not Found message. Apparently it cannot find the OrderTickets directory because it's not the first directory of the NTOutput folder.

When I remove the OrderTickets fromthe FileFindFirst method I get the Handled\ folder returned. I guess it can only find the first folder.

Anyone got any suggestions how I can solve this?

Much appreciated. 

 

If you want to work with COMMON directory you have to specify the flag :

      long search_handle=FileFindFirst("NTOutput\\OrderTickets\\*",file_name,FILE_COMMON);
Reason: