Erlang Central

Difference between revisions of "File exist"

From ErlangCentral Wiki

(First draft)
 
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