list_dir
此方法用于列出特定目录的内容。
语法 (Syntax)
list_dir(directory)
参数 (Parameters)
directory - 需要列出内容的目录。
返回值 (Return Value)
包含目录中文件名的项目列表。
例如 (For example)
-module(helloworld).
-export([start/0]).
start() ->
io:fwrite("~p~n",[file:list_dir(".")]).
输出 (Output)
根据当前工作目录的内容,将相应地显示文件列表。 示例输出显示在以下程序中 -
{ok,["helloworld.erl",".cg_conf","Newfile.txt","helloworld.beam"]}