Julia's readir lists a directory but it doesn't say if the items are files or directories. Is there any way to toggle this?
Julia's readir lists a directory but it doesn't say if the items are files or directories. Is there any way to toggle this?
readdir gets the names of everything in the current directory. We can use isdir or isfile to filter it down.
# Get all directories
filter(isdir, readdir())
# Get all files
filter(isfile, readdir())
# Return a tuple consisting of the filename and whether or not it's a directory
map((x) -> (x, isdir(x)), readdir())