unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* How can I apply a function to all file in a directory,recursively?
@ 2003-05-25 12:15 Wang Yin
  2003-05-26  8:41 ` Kai Großjohann
  0 siblings, 1 reply; 2+ messages in thread
From: Wang Yin @ 2003-05-25 12:15 UTC (permalink / raw)


Hi,

I need some elisp code that can apply a function (actually,
semanticdb-get-database) to all file in a directory and it's
subdirectories recursively.

I know little Elisp, but I need this code urgently.
Can anyone write the code for me?

Thank you very much!

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: How can I apply a function to all file in a directory,recursively?
  2003-05-25 12:15 How can I apply a function to all file in a directory,recursively? Wang Yin
@ 2003-05-26  8:41 ` Kai Großjohann
  0 siblings, 0 replies; 2+ messages in thread
From: Kai Großjohann @ 2003-05-26  8:41 UTC (permalink / raw)


Wang Yin <wang-y01@mails.tsinghua.edu.cn> writes:

> I need some elisp code that can apply a function (actually,
> semanticdb-get-database) to all file in a directory and it's
> subdirectories recursively.

The function directory-files gives you a list of files and
directories in a directory.  You can then examine each element of the
list whether it is a directory.  If it is, call yourself recursively.

(defun walk-subtree (dir)
  (mapcar (lambda (f)
            (setq f (expand-file-name f dir))
            (if (file-directory-p f) 
                (walk-subtree f)
              (message "Found a file: %s" f)))
          (directory-files dir)))

-- 
This line is not blank.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-05-26  8:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-05-25 12:15 How can I apply a function to all file in a directory,recursively? Wang Yin
2003-05-26  8:41 ` Kai Großjohann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).