<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    Hello Claus,<br>
    <br>
    You can use "isfile" function to check existence if a file and
    "isdir" for folder.<br>
    <a class="moz-txt-link-freetext"
      href="https://help.scilab.org/docs/6.0.0/en_US/isfile.html">https://help.scilab.org/docs/6.0.0/en_US/isfile.html</a><br>
    <a class="moz-txt-link-freetext"
      href="https://help.scilab.org/docs/6.0.0/en_US/isfile.html">https://help.scilab.org/docs/6.0.0/en_US/isdir.html</a><br>
    <br>
    Regards,<br>
    Antoine<br>
    <div class="moz-cite-prefix">Le 25/01/2018 à 17:43, Claus Futtrup a
      écrit :<br>
    </div>
    <blockquote type="cite"
cite="mid:CA+Q5Pwvz-_HsGNc6iTu=Nzg0hR7AUWY=i64h+B0uNE7+OTo_XQ@mail.gmail.com">
      <div dir="ltr">
        <div>Dear Scilabers</div>
        <div><br>
        </div>
        <div>I wish to check for the existence of some files. For this I
          created a simple function:</div>
        <div><br>
        </div>
        <div>
          <pre style="font-family:Monospaced;font-size:14px;font-style:normal"><span style="color:rgb(74,85,219)">[</span><span style="color:rgb(0,0,0)">out</span><span style="color:rgb(74,85,219)">]</span><span style="color:rgb(92,92,92)">=</span><span style="color:rgb(176,24,19)">function</span> <span style="color:rgb(0,0,0);text-decoration:underline">file_exist</span><span style="color:rgb(74,85,219)">(</span><span style="color:rgb(131,67,16);font-weight:bold">fname</span><span style="color:rgb(74,85,219)">)</span>
    <span style="color:rgb(74,85,219)">[</span><span style="color:rgb(0,0,0)">fd</span><span style="color:rgb(0,0,0)">,</span> <span style="color:rgb(0,0,0)">err</span><span style="color:rgb(74,85,219)">]</span> <span style="color:rgb(92,92,92)">=</span> <span style="color:rgb(50,185,185)">mopen</span><span style="color:rgb(74,85,219)">(</span><span style="color:rgb(131,67,16);font-weight:bold">fname</span><span style="color:rgb(74,85,219)">)</span><span style="color:rgb(0,0,0)">;</span> <span style="color:rgb(100,174,100);font-style:italic">// Try to open file, mode: </span><span style="color:rgb(100,174,100);font-style:italic">'</span><span style="color:rgb(100,174,100);font-style:italic">br</span><span style="color:rgb(100,174,100);font-style:italic">'</span><span style="color:rgb(100,174,100);font-style:italic"> (binary-reading)</span>
    <span style="color:rgb(160,32,240)">if</span> <span style="color:rgb(0,0,0)">err</span><span style="color:rgb(92,92,92)">==</span><span style="color:rgb(188,143,143)">0</span> <span style="color:rgb(160,32,240)">then</span>
        <span style="color:rgb(0,0,0)">out</span><span style="color:rgb(92,92,92)">=</span><span style="color:rgb(218,112,214)">%t</span><span style="color:rgb(0,0,0)">;</span>
        <span style="color:rgb(50,185,185)">mclose</span><span style="color:rgb(74,85,219)">(</span><span style="color:rgb(131,67,16);font-weight:bold">fname</span><span style="color:rgb(74,85,219)">)</span><span style="color:rgb(0,0,0)">;</span>
    <span style="color:rgb(160,32,240)">else</span>
        <span style="color:rgb(0,0,0)">out</span><span style="color:rgb(92,92,92)">=</span><span style="color:rgb(218,112,214)">%f</span>
    <span style="color:rgb(160,32,240)">end</span>
<span style="color:rgb(176,24,19)">endfunction</span></pre>
        </div>
        <div><br>
        </div>
        <div>I didn't check, but presumably this would work.</div>
        <div><br>
        </div>
        <div>Is such a function already available? Which way is the
          "official" way to do this in Scilab?</div>
        <div><br>
        </div>
        <div>Maybe I'm searching for the wrong word, but I found some
          ways in Scilab. The "fileinfo" seems to be the closest one to
          what I wish to do.</div>
        <div><br>
        </div>
        <div>Matlab has a function "exist()" which can check for files
          too. Scilab has the function "exists()" - notice the function
          name is plural, not singluar - and this one AFAIK only works
          for Scilab variables (not files), although I didn't check.</div>
        <div><br>
        </div>
        <div>If fileinfo is the right way, maybe an example for the help
          could be to make a file_exist function, to show ... (?)
          ... when I search for Scilab file exist function, I'm not
          guided in any specific way/direction and find myself insecure
          whether I find the right help.</div>
        <div><br>
        </div>
        <div>Best regards,</div>
        <div>Claus<br>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:users@lists.scilab.org">users@lists.scilab.org</a>
<a class="moz-txt-link-freetext" href="http://lists.scilab.org/mailman/listinfo/users">http://lists.scilab.org/mailman/listinfo/users</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>