When we turn a computer off, it should remember the functions and the data we worked
on. Otherwise we have to re-enter everything when we turn it on again. Things that
a computer is to remember for a long time are put into <#18867#>files<#18867#>. A file is a
sequence of small pieces of data. For our purposes, a file resembles a list; we
ignore why and how a computer stores a file in a permanent manner.
#picture18868#
<#18976#>Figure: A sample directory tree<#18976#>
It is more important to us that, on most computer systems, the collection of files
is organized in <#18978#>directories<#18978#>. Roughly speaking, a directory contains some files and
some more directories. The latter are called subdirectories and may contain yet
more subdirectories and files, and so on. The entire collection is collectively
called a <#18980#>file system<#18980#> or a <#18981#>directory tree<#18981#>.
Figure~#figaccountant#18982> contains a graphical sketch of a small directory
tree. The tree's <#18984#>root directory<#18984#> is <#18985#>TS<#18985#>. It contains one file, called
<#18986#>read!<#18986#>, and two subdirectories, called <#18987#>Text<#18987#> and <#18988#>Libs<#18988#>. The first
subdirectory, <#18989#>Text<#18989#>, contains only three files; the latter, <#18990#>Libs<#18990#>,
contains only two subdirectories, each of which contains at least one file. Each
box has one of two annotations. A directory is annotated with DIR, and a file is
annotated with a number, which signifies the file's size. Altogether <#18991#>TS<#18991#>
contains seven files and consists of five (sub)directories.
<#18994#>Exercise 16.1.1<#18994#>
How many times does the file name <#18996#>read!<#18996#>\ occur in the directory tree <#18997#>TS<#18997#>?
What is the total size of all the files in the tree? How deep is the tree (how many
levels does it contain)?~ Solution<#63946#><#63946#>