10.1 Problem

There is this nice little command tree that recursively lists files and subdirectories in a given location. Let’s try to get some of that with Julia.

Write a function printCatalogTree that displays the contents of a given directory like so (the output doesn’t have to be exact):

~/Desktop/catalog_x/
|---catalog_y/
|   |---catalog_z/
|   |   |---file_z.txt
|   |---file_y.txt
|---file_x.txt

2 directories, 3 files

Here, we got three nested catalogs: x, y, and z. Each contains a file of a corresponding name inside of it.

Hint: If you are stuck now, start by reading about Julia’s Filesystem.



CC BY-NC-SA 4.0 Bartlomiej Lukaszuk