scsh-users
[Top] [All Lists]

find in Scsh

To: scsh-bugs@martigny.ai.mit.edu
Subject: find in Scsh
From: Shriram Krishnamurthi <shriram@mahasamatman.cs.rice.edu>
Date: Sun, 4 Feb 1996 23:14:19 -0600
Reply-to: shriram@cs.rice.edu
I suspect this topic has been done to death, but I'll ask anyway.  As
a disclaimer, I should add that I'm using documentation that is many
months old, but the behavior doesn't seem to have changed.

What was the rationale behind the behavior of file-match, ie, the
restriction on the depth of traversal?  Put differently, what's the
right way of getting the same output as produced by
all-html-files-below, defined as follows:

(define subdirs-of
  (lambda (dir)
    (file-match dir #t file-directory?)))

(define html-files-of  ; Could have used a glob here instead
  (lambda (dir)
    (file-match dir #t "\\.html$")))

(define all-html-files-below  ; Could have done a single flatten
  (lambda (dir)
    (append (html-files-of dir)
      (apply append (map all-html-files-below (subdirs-of dir))))))

Thanks,
'shriram

<Prev in Thread] Current Thread [Next in Thread>