file:list_dir/1 cannot lists dot(.) and dot-dot(..) directories
Attila Rajmund Nohl
Tue Jun 29 12:49:46 CEST 2021
Yao Bao <free7by@REDACTED> ezt írta (időpont: 2021. jún. 29., K, 6:11):
> I'm trying to list all files in a directory, then I found file:list_dir/1, it works fine but dot(.) and dot-dot(..) is missing.
> I would expect the result from file:list_dir/1 in Erlang is the same as readdir(dirp) in C.
> Is there any (historical) reason why these two special directories missing from the return?
I guess it's pretty rare that you actually want to do something with
the "." and ".." directory entries, so it makes sense to not return
them... For example, in Perl by default the read_dir function in the
File::Slurp module does not return the "." and ".." entries (there's
an option to return these).
More information about the erlang-questions