- Erlang Tutorial
- Erlang - Home
- Erlang - Overview
- Erlang - Environment
- Erlang - Basic Syntax
- Erlang - Shell
- Erlang - Data Types
- Erlang - Variables
- Erlang - Operators
- Erlang - Loops
- Erlang - Decision Making
- Erlang - Functions
- Erlang - Modules
- Erlang - Recursion
- Erlang - Numbers
- Erlang - Strings
- Erlang - Lists
- Erlang - File I/O
- Erlang - Atoms
- Erlang - Maps
- Erlang - Tuples
- Erlang - Records
- Erlang - Exceptions
- Erlang - Macros
- Erlang - Header Files
- Erlang - Preprocessors
- Erlang - Pattern Matching
- Erlang - Guards
- Erlang - BIFS
- Erlang - Binaries
- Erlang - Funs
- Erlang - Processes
- Erlang - Emails
- Erlang - Databases
- Erlang - Ports
- Erlang - Distributed Programming
- Erlang - OTP
- Erlang - Concurrency
- Erlang - Performance
- Erlang - Drivers
- Erlang - Web Programming
- Erlang Useful Resources
- Erlang - Quick Guide
- Erlang - Useful Resources
- Erlang - Discussion
Erlang - list_dir
This method is used to list down the contents of a particular directory.
Syntax
list_dir(directory)
Parameters
directory − The directory for which the contents need to be listed.
Return Value
The list of items which contains the file names in the directory.
For example
-module(helloworld). -export([start/0]). start() -> io:fwrite("~p~n",[file:list_dir(".")]).
Output
Depending on the contents of your current working directory, the list of files will be displayed accordingly. An example output is shown in the following program −
{ok,["helloworld.erl",".cg_conf","Newfile.txt","helloworld.beam"]}
erlang_file_input_output.htm
Advertisements