recursive stuff

Started by tom, September 25, 2004, 01:18:13 PM

Previous topic - Next topic

tom

Hi guys,



Sorry, I'm a bonehead.  I want to perform an action on all the files

in a directory, in any subdirectories, and any sub-subdirecories.



I can use a combo of (directory "dir") and (directory? "dir"), right?



lisp, scheme, newlisp, they all evaluate from the inside out, right?

the innermost parentheses first, then out?



I may "get it" one day...



Thanks for your patience :-)

Lutz

#1
try this:



(define (show-tree dir)
  (dolist (nde (directory dir))
    (if (and (directory? (append dir "/" nde)) (!= nde ".") (!= nde ".."))
          (show-tree (append dir "/" nde))
          (println (append dir "/" nde)))))

(show-tree "/usr")    ; on Linux/UNIX

(show-tree "/")

(show-tree "c:\") ;; works ~ on Win32

(show-tree "c:/") ;; also works on Win32




Lutz