How to count files in current directory in Julia?
If you plan to count files in current directory in Julia, you can just run following code:
files_and_dirs = readdir(pwd()) # reading files and directory
function count()
global num =0
for i in files_and_dirs
if isfile(i)
num +=1
end
end
end
count()
println(num)
Example:
> juliea> julia number_of_files_in_current_directory.jl
Output:
19
Source: