disk_list_locdirs
Updated: Oct6,2019

Compile a list of all subdirectories in your local working directory.


Usage: disk_list_locdirs N 
arg1 - debug (Y/N)  

A simple example is shown below.

% pwd
/home/sco/tmp 
% ls 
A1/  disk_survey.out  list.1   List.dirs   pars.in
A2/  junk.fp	      list.10  List.files
% disk_list_locdirs N > My_list.subdirs 
% cat My_list.subdirs 
A1
A2

It is worth noting that there are ways of doing this sort of thing with purely unix commands. Here is a way to do it with "ls":


% ls -l --block-size=1 -R A*
A1:
total 1060864
-rw-r--r-- 1 sco sco 348480 Oct  5 21:44 AA1
-rw-r--r-- 1 sco sco 348480 Oct  5 21:44 AA2
-rw-r--r-- 1 sco sco 348480 Oct  5 21:44 AA3
drwxr-xr-x 2 sco sco   4096 Oct  6 12:00 CC0/

A1/CC0:
total 1056768
-rw-r--r-- 1 sco sco 348480 Oct  6 12:00 AA1
-rw-r--r-- 1 sco sco 348480 Oct  6 12:00 AA2
-rw-r--r-- 1 sco sco 348480 Oct  6 12:00 AA3

A2:
total 1056768
-rw-r--r-- 1 sco sco 348480 Oct  5 21:50 AA1
-rw-r--r-- 1 sco sco 348480 Oct  5 21:50 AA2
-rw-r--r-- 1 sco sco 348480 Oct  5 21:50 AA3

Notice that I used the "-R" flag to recursively decsend the directory tree. This is what produced the listing of the files in ./A1/CC0. The "--block-size=1" argument is what specified that I want my file sizez to be specified in units of bytes. This is a complete list, but gives more than I really wanted. I just wanted a file listing the directory names. I would have to parse the above output to get that.

Here is a way to do it with "du":


% du -a --block-size=1 A*
352256	A1/AA3
352256	A1/AA2
352256	A1/AA1
352256	A1/CC0/AA3
352256	A1/CC0/AA2
352256	A1/CC0/AA1
1060864	A1/CC0
2121728	A1
352256	A2/AA3
352256	A2/AA2
352256	A2/AA1
1060864	A2

This is closer to what I wanted, but is recursively lists all of the subdirectories. It is nice that it gives the size in bytes of each node in the tree, but again I would have to parse this output to get what I want: a simple list of the subdirectories in my local working directory.




Back to calling page