%% From the Erlang shell, or in a program, match {ok, []}. %% If this works the directory is empty. 3> {ok, []} = file:list_dir_all("/usr"). ** exception error: no match of right hand side value {ok,["X11R6","X11","standalone","share","sbin","local", "libexec","lib","bin"]} 4> {ok, []} = file:list_dir_all("/asd"). ** exception error: no match of right hand side value {error,enoent} 5> {ok, []} = file:list_dir_all("./empty"). {ok,[]}