Hello Claus,

You can use "isfile" function to check existence if a file and "isdir" for folder.
https://help.scilab.org/docs/6.0.0/en_US/isfile.html
https://help.scilab.org/docs/6.0.0/en_US/isdir.html

Regards,
Antoine
Le 25/01/2018 à 17:43, Claus Futtrup a écrit :
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
     end
endfunction

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


_______________________________________________
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users

_______________________________________________
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users

Reply via email to