September 2013
Intermediate to advanced
548 pages
12h 25m
English
Three functions in file are used for directory
operations. list_dir(Dir) is used to produce a list of
the files in Dir, make_dir(Dir) creates a new
directory, and del_dir(Dir) deletes a
directory.
If we run list_dir on the code directory that I’m using
to write this book, we’ll see something like the following:
| | 1> cd("/home/joe/book/erlang/Book/code"). |
| | /home/joe/book/erlang/Book/code |
| | ok |
| | 2> file:list_dir("."). |
| | {ok,["id3_v1.erl~", |
| | "update_binary_file.beam", |
| | "benchmark_assoc.beam", |
| | "id3_v1.erl", |
| | "scavenge_urls.beam", |
| | "benchmark_mk_assoc.beam", |
| | "benchmark_mk_assoc.erl", |
| | "id3_v1.beam", |
| | "assoc_bench.beam", |
| | "lib_misc.beam", |
| | "benchmark_assoc.erl", |
| | "update_binary_file.erl", |
| | "foo.dets", ... |
Read now
Unlock full access