home *** CD-ROM | disk | FTP | other *** search
/ The CDPD Public Domain Collection for CDTV 3 / CDPDIII.bin / pd / programming / gnusmalltalk / print_file_names < prev    next >
Text File  |  1992-02-15  |  608b  |  34 lines

  1. #!/bin/sh
  2.  
  3. # Usage:
  4. #    print_file_names [ -d dir ] file_or_dir  [ file_or_dir  ... ]
  5. #
  6. # Prints out each of the file names given by its argument.  If the
  7. # file turns out to be a directory, the contents of that directory
  8. # are printed.  The -d flag says "print the file names relative to <dir>"
  9. # instead of relative to the current directory.  Symbolic links
  10. # are suppressed.
  11.  
  12.  
  13. if [ "$1" = "-d" ]
  14. then
  15.     
  16.     cd $2
  17.     shift 2
  18. fi
  19.  
  20.  
  21. for file
  22. do
  23.     if [ ! -h ${file} ]        
  24.     then                # suppress symbolic links
  25.         echo ${file}
  26.         if [ -d ${file} ]
  27.          then    # recurse 
  28.             print_file_names `/bin/ls -d ${file}/*`
  29.         fi
  30.     fi
  31. done
  32.  
  33.  
  34.