File exist

From Erlang Community

(Difference between revisions)
Revision as of 08:11, 12 October 2007 (edit)
Andreas.hillqvist (Talk | contribs)
(First draft)
← Previous diff
Revision as of 08:14, 12 October 2007 (edit) (undo)
Andreas.hillqvist (Talk | contribs)

Next diff →
Line 1: Line 1:
There are many ways to test if a file exists in Erlang. Here are some examples: There are many ways to test if a file exists in Erlang. Here are some examples:
<code> <code>
- +case filelib:is_regular(Name) of
 +true ->
 + io:format("File exist.\n");
 +false ->
 + io:format("File dose not exist.\n")
 +end
</code> </code>
-[[Category:CookBook]]+[[Category:CookBook]] [[Category:FileRecipes]]

Revision as of 08:14, 12 October 2007

There are many ways to test if a file exists in Erlang. Here are some examples:

case filelib:is_regular(Name) of
true ->
    io:format("File exist.\n");
false ->
    io:format("File dose not exist.\n")
end
Erlang/OTP Projects
Personal tools