Erlang - is_file



This method is used to determine if a file is indeed a file. This method is a part of the filelib library.

Syntax

is_file(filename)

Parameters

  • filename − This is the file name for which it needs to be determined if it is a file or not.

Return Value

True, if the file exists and is indeed a file.

For example

-module(helloworld). 
-export([start/0]). 

start() -> 
   io:fwrite("~p~n",[filelib:is_file("Renamedfile.txt")]).

Output

If the file exists, the output will be true

erlang_file_input_output.htm
Advertisements