От: | Трурль | ||
Дата: | 24.01.06 06:38 | ||
Оценка: | 14 (1) |
parse_dir(PathToDir) ->
case filelib:is_dir(PathToDir) of
false -> {error, not_a_dir};
true -> Dirs=get_dirs(PathToDir), {dir,Dirs, get_files(Dirs)}.
end.
get_dirs(Path) ->
[Path|lists:append([get_dirs(X)|| X <- filelib:wildcard(Path++"/*"),filelib:is_dir(X)])].
get_files(Dirs) ->
[{Y,filelib:file_size(Y)}|| Y <- lists:append([filelib:wildcard(X++"/*")||X <- Dirs])].