Readdir return full path

Just wanted to mention that there is a Glob package that can be used to read directories and do some filtering as well:

julia> using Glob

julia> glob("*.csv", path_to_dir) # glob("*", path_to_dir) to list all files

which returns an array of full paths: I generally find it handier than a manual readdir, filter and joinpath.

Maybe one reason why readdir does not join the path by default is that it makes filtering the file list easier before joining the rest of the path.

1 Like

Just to let people know this is part of Base now:

readdir(dir::AbstractString=pwd();
      join::Bool = false, # <-- HERE
      sort::Bool = true,
  ) -> Vector{String}
4 Likes