title: How can i get list of files from a directory?
body: <p>I'm trying to get list of files from a directory in <strong>D365 Business central</strong> , because in the <strong><code>AL</code></strong> language <strong><code>DotNet</code></strong> var is not supported, so i don't know how can i get those files paths.</p>
  
  <p>In my requirement i know the path of folder but need to get actual files paths in that folder. </p>
  
  <blockquote>
    <p>Ex: Folder is E:\Dynamically\</p>
    
    <p>But i want to get files path like:</p>
    
    <ol>
    <li><p>E:\Dynamically\1.txt</p></li>
    <li><p>E:\Dynamically\2.txt</p></li>
    <li><p>E:\Dynamically\3.txt</p></li>
    </ol>
  </blockquote>
  
  <p>I tried to search inbuilt function in <strong><code>Codeunit 419</code></strong>("File Management"), and tried to get using Azure function. I am adding my code for get file from that directory but it is for one file.</p>
  
  <pre><code>action("Import Files")
              {
                  ApplicationArea = All;
                  Image = Import;
  
                  trigger OnAction();
                  var
                      FromFile: Text;
                      FileMgt: Codeunit "File Management";
                  begin
                      Init();
                      Message(FileMgt.GetExtension('E:\Dynamically\' + 
                      Format(GetFileName)));
                      FromFile := 'E:\Dynamically\' + Format(GetFileName);
                      "Attached File".Import(FromFile);
                      "Attched File Name" := Format(GetFileName);
                      "Attached file Extension" := 
                       FileMgt.GetExtension(Format(GetFileName));
                      Insert(true);
                      MESSAGE('Successfully Import.');
                  end;
              }
  </code></pre>
  
  <p>Here's the result of my import File code.</p>
  
  <p><a href="https://i.stack.imgur.com/kQaAk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kQaAk.png" alt="enter image description here"></a></p>