I need a function in erlang that will read files in something directory. I am writing 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. For example, I run the erlang shell:
1> module: files_count (/ home /).
I see exceptrion: ** exception error: no function matching module: files_count ("/ home /")
What's wrong?
Thanks.
source share