Share via


HOWTO: Using WinAPI FindFirstFile, FindNextNext in Batch Jobs.

In batch job is not posible to call WinAPI functions WINAPI::FindFirstFile(..) and WINAPI::FindNextFile(...) . This is limited only for code running on client. Sometimes is necesary have similar function for code running on server (or in batches). There is a code sample which is using .NET Framework.

 static void Job1(Args _args)
{
    FilePath sFilePath;
    
    System.IO.DirectoryInfo di;
    System.IO.FileInfo[] fis;
    System.IO.FileInfo fi;
    int i;
    int l;
    ;

    sFilePath;= "C:\\temp\\test\\";
    di = new System.IO.DirectoryInfo(sFilePath;);
    fis = di.GetFiles();
    l = fis.get_Length();
    for (i = 0; i < l; i++)
    {
        fi = fis.GetValue(i);
        info(fi.get_FullName());
    }
}

Karel F

Comments