I need in function in erlang which will be count files in something directory. I write this function:
files_count(dir) ->
case file:list_dir(dir) of
{ok, FileNames} ->
length(FileNames);
{error, Reason} ->
Reason
end.
When i try to test it. I run in erlang shell for example:
1> module:files_count(/home/).
I see exceptrion: ** exception error: no function clause matching module:files_count("/home/")
What's wrong?
Thank you.