无涯教程-Erlang - list_dir函数

87 阅读1分钟

此方法用于列出特定目录的内容。

list_dir - 语法

list_dir(directory)
  • directory  -  需要列出其内容的目录。

list_dir - 返回值

包含目录中文件名的项目列表。

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

start() -> io:fwrite("pn",[file:list_dir(".")]).

根据当前工作目录的内容,文件列表将相应显示。

{ok,["helloLearnfk.erl",".cg_conf","Newfile.txt","helloLearnfk.beam"]}

参考链接

www.learnfk.com/erlang/erla…