AX: Listing files in a folder (code example)


Some time you will maybe need to research some file in the folder.

So find here a little piece of code you can make a listing of file in the directory (here, temp folder)

 

static void myFileList(Args _args)
{
    FilePath                sFilePath;

    System.IO.DirectoryInfo di;
    System.IO.FileInfo[]    fis;
    System.IO.FileInfo      fi;
    int                     i;
    int                     l;
    ;

    sFilePath   = WinAPI::getTempPath();
    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());
    }
}

 

Disclaimer
“Microsoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability or fitness for a particular purpose. This mail message assumes that you are familiar with the programming language that is being demonstrated and the tools that are used to create and debug procedures.”

 

Comments (0)