unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: kai.grossjohann@gmx.net (Kai Großjohann)
Subject: Re: How can I apply a function to all file in a directory,recursively?
Date: Mon, 26 May 2003 10:41:09 +0200	[thread overview]
Message-ID: <84llwudrru.fsf@lucy.is.informatik.uni-duisburg.de> (raw)
In-Reply-To: phptm7cjcw.fsf@wangyin.com

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.

      reply	other threads:[~2003-05-26  8:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=84llwudrru.fsf@lucy.is.informatik.uni-duisburg.de \
    --to=kai.grossjohann@gmx.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).