[Scilab-users] File exist function?

Claus Futtrup cfuttrup at gmail.com
Thu Jan 25 17:43:36 CET 2018


Dear Scilabers

I wish to check for the existence of some files. For this I created a
simple function:

[out]=function file_exist(fname)
    [fd, err] = mopen(fname); // Try to open file, mode: 'br' (binary-reading)
    if err==0 then
        out=%t;
        mclose(fname);
    else
        out=%f
    endendfunction


I didn't check, but presumably this would work.

Is such a function already available? Which way is the "official" way to do
this in Scilab?

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.

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.

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.

Best regards,
Claus
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20180125/3749a71d/attachment.htm>


More information about the users mailing list