Subdirectory listing

Benjamin Olasov olasov at cs.columbia.edu
Sun May 21 02:28:36 AEST 1989



I'm interested in finding a unix command usage that will return the complete
path names of all subdirectories below a given directory, so that, given a
directory tree like this:


                                  |----- /user1
                                  |
                  /               |
             /sys --              |----- /user2 ----- /data ----- /bin
           /      \               |
         /                        |
       /                          |----- /user3 ----- /docs
/files ----- /home ----- /users --|
       \                          |
         \                        |----- /user4
           \                      |
             /vol                 |
                                  |----- /user5
                                  |  
                                  |
                                  |----- /user6 ----- /mail
                                                \
                                                  \
                                                    \ /hacks


the command would take the directory of interest as its argument, as in:

$ mycommand /files/home/users

and return the subdirectories in the format:

/files/home/users/user1
/files/home/users/user2
/files/home/users/user2/data
/files/home/users/user2/data/bin
/files/home/users/user3
/files/home/users/user3/docs
/files/home/users/user4
/files/home/users/user5
/files/home/users/user6
/files/home/users/user6/mail
/files/home/users/user6/hacks

What's the easiest way to do this?

Ben



More information about the Comp.unix.wizards mailing list