It’s Base.Filesystem.readdir
in julia:
https://docs.julialang.org/en/v1/base/file/#Base.Filesystem.readdir
It’s readdir
in R, it has exclude
argument as regular expression:
readdir(dir::AbstractString=pwd();
join::Bool = false,
sort::Bool = true,
) -> Vector{String}
Present readdir
has two arguments, how about pattern matching feature?
For example:
julia> readdir()
4-element Vector{String}:
"Australia-1950.xlsx"
"Australia-1955.csv"
"Australia-1960.csv"
"example.jl"
julia> readdir(pattern = "*.csv") # Common sense
2-element Vector{String}:
"Australia-1955.csv"
"Australia-1960.csv"
julia> readdir(pattern = Not("*.csv")) # What a native julia
2-element Vector{String}:
"Australia-1950.xlsx"
"example.jl"
julia> readdir(pattern = Not(["*.csv", "*.jl"])) # What a native julia 2
1-element Vector{String}:
"Australia-1950.xlsx"
julia> readdir(pattern = "Australia*") # Regular expression. It could be tricky or just use RE.
3-element Vector{String}:
"Australia-1950.xlsx"
"Australia-1955.csv"
"Australia-1960.csv"
Of course I can do all above examples using regular expression, not that hard, but I guess it’s gonna fantastic if the feature become native. And I think regular expression is too much to use somtimes
in these function, so it’ll be pleasure if “*.csv” thing is implemented although whole regular expression are not supported. Alternatively, extension = "csv"
will be also great.