English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Erlang File list_dir Method

Files in Erlang

This method is used to list the contents of a specific directory.

Syntax

list_dir(directory)

Parameter

  • directory −Directory that needs to be listed for its content.

Return Value

A list of items containing filenames in the directory.

-module(helloworld). 
-export([start/0]). 
start() -> 
   io:fwrite("~p~n",[file:list_dir(".")]).

The file list will be displayed accordingly based on the content of the current working directory. Example output is shown in the following program.-

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

Files in Erlang