Working with the filesystem
Julia provides a variety of functions for reading folders and processing files natively, and we will meet some of these in the next chapter. However, as a tester, I have included a few examples here.
I got an error after exiting the following process, so had wrapped it in a try
/catch
block to suppress the output of the error – note that this was after the run()
call had succeeded:
#= Running the following gave a FAILED Process error on exit, julia> cd(string(ENV["HOME"],"/MJ2/Chp05/Code05")); julia> run(`wc $(readdir())`) Wrapping the run() function it in a try/catch block will trap the error. =# julia> try run(`wc $(readdir())`) catch end 3424 11555 152017 Chp05.ipynb 791 2796 20108 Chp05.jl 1843 10493 67627 Chp05.md wc: Scripts: read: Is a...