[Scilab-users] File exist function?
Antoine ELIAS
antoine.elias at scilab-enterprises.com
Thu Jan 25 19:40:15 CET 2018
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 at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20180125/71c35cf2/attachment.htm>
More information about the users
mailing list