Rails vs Phoenix: MVC Returning row data from PostgreSQL functions w/ Ecto

Recursively List Files in Elixir

Quick Elixir ditty to recursively list the files at a given path (relative or absolute):

defmodule FileExt
  def ls_r(path \\ ".") do
    cond do
      File.regular?(path) -> [path]
      File.dir?(path) ->
        File.ls!(path)
        |> Enum.map(&Path.join(path, &1))
        |> Enum.map(&ls_r/1)
        |> Enum.concat
      true -> []
    end
  end
end

http://www.ryandaigle.com/a/recursively-list-files-in-elixir