How to list only directories (not files) in current directory in Julia [with screenshots]
To list files in current directory and exclude counting directories (sub-directories) in current folder we just use readdir() function and then we count only files.
Let's see, what we have in a directory (files and directories):
$ ls
output:
dima@linux-zsrx:~/julia> ls
bookings hello-world.jl
books.txt libs
count_files.jl list_only_files.jl
You see, that we have two directories ("libs" and "bookings") and the rest are files. Our goal is to list only those two directories (de facto: only subdirectories/sub-folders) and exclude files. Let's create a file with the name list_only_dirs.jl in order to use it in every directory in our system, and put following code into it: