next up previous contents
Next: Listing names in the Up: Basic operations for managing Previous: Basic operations for managing

Managing directories

    

tabular430

This set of the commands is purposed to manage subdirectories. The directory system have the same principle as in file systems. Directories can be created by the command md and they can be removed by the command rd. The NDA kernel maintains the current working directory which can be changed by the command cd.

Subdirectories should always be created by the command md, but items can be referred by giving the whole or relative path name to an entry, for instance, "/tmp/data" or "tmp/data".

The following examples demonstrate some cases which can be more useful to manage by splitting information processing to distinct directories.

Example: Because the Boston data has 14 fields, it is clearer to hide fields under the directory "bostondir". Note that only one level of the new directories can be created at a time by the command md.

# load data to the directory "data"
NDA> md bostondir
NDA> cd bostondir
NDA> load boston.dat
NDA> cd ..
NDA> ls
bostondir

The Boston data is loaded to the root directory "/". Then it is preprocessed and the results are stored in the different subdirectory "process1".

# load data to the root directory
NDA> pwd
/
NDA> load boston.dat
NDA> md process1
# preprocess the data and store results in a subdirectory
NDA> prepro -d boston -dout process1/data -e -n
...

It is clear that the analyzing process uses only data which have been got by selecting low-priced apartments by the command selrec (see Sect. 4.2.3). Then the analyzing process of this data is isolated to its own directory "phase2" as the following commands show.

...
# select a part of the data from the boston data
NDA> md phase2
NDA> selrec -d boston -expr 'boston.rate' < 40; -dout phase2/data
NDA> cd phase2
# data analysis for low-priced apartments
...

References to name entries in different directories can be given as an absolute or relative path to the current working directory. The example shows also that only an empty directory can be removed.

...
# references to name entries in different directories
NDA> ls ../bostondir -fr *
boston
boston.crim
boston.zn
...
NDA> somtr -d ../bostondir/boston -sout som1 -l 4
NDA> cd ..
NDA> rd bostondir
-134
Try to remove a directory that is not empty
# Error caused by the deletion of the non-empty subdirectory.
# Thus let's remove items under it firstly
NDA> rm bostondir/boston
NDA> rd bostondir
...



Erkki Hakkinen
Thu Sep 24 11:51:34 EET DST 1998