title: How can I store list of directory files using pure Red language?
body: <p>I am trying to store list of files from directory in variable (using <strong>only</strong> CLI, Red version: 0.6.3).</p>
  
  <p>I tested couple of functions from <a href="http://www.red-by-example.org/#cat-f01" rel="nofollow noreferrer">"Red by example"</a> documentation, but all of them give me only an CLI output with list of elements from directory:</p>
  
  <ul>
  <li><a href="http://www.red-by-example.org/#list-dir" rel="nofollow noreferrer">list-dir</a></li>
  <li><a href="http://www.red-by-example.org/#ls" rel="nofollow noreferrer">ls</a></li>
  <li><a href="http://www.red-by-example.org/#dir" rel="nofollow noreferrer">dir</a></li>
  </ul>
  
  <p>When I tried save it into variable, I've got an errors like:</p>
  
  <pre><code>&gt;&gt; var: list-dir %tests
      other-tests.red         README.md               poc-tests.red      
  *** Script Error: var: needs a value
  *** Where: var
  *** Stack: 
  
  &gt;&gt; files: ls tests
  other-tests.red         README.md               poc-tests.red       
  *** Script Error: files: needs a value
  *** Where: files
  *** Stack:  
  
  &gt;&gt; other: dir %tests
  other-tests.red         README.md               poc-tests.red       
  *** Script Error: other: needs a value
  *** Where: other
  *** Stack:  
  </code></pre>
  
  <p>I also found the <a href="http://www.red-by-example.org/#call" rel="nofollow noreferrer">call</a> method, which give me possibility to run external scripts (like shell scripts), and by that I can execute OS command <code>ls</code>:</p>
  
  <pre><code>&gt;&gt; filelist: ""
  &gt;&gt; call/output "ls tests" filelist
  &gt;&gt; print filelist
  other-tests.red
  poc-tests.red
  README.md
  </code></pre>
  
  <p>But this solution is dependent on the operating system. For example in MS Windows <code>call/output "dir tests" filelist</code> will work.</p>
  
  <p><strong>Can anyone tell me - is there another solution for that using pure Red code without executing external scripts?</strong></p>
  
  <p>Maybe somewhere there are some <code>magic</code> functions from <strong>Red System</strong>, whose will give us that?</p>
  
  <p>That's would be great to be independent of OS.</p>
  
  <p>Thanks for the answers</p>