From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: kai.grossjohann@gmx.net (=?iso-8859-1?q?Kai_Gro=DFjohann?=) Newsgroups: gmane.emacs.help Subject: Re: How can I apply a function to all file in a directory,recursively? Date: Mon, 26 May 2003 10:41:09 +0200 Organization: University of Duisburg, Germany Sender: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: <84llwudrru.fsf@lucy.is.informatik.uni-duisburg.de> References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1053938739 6156 80.91.224.249 (26 May 2003 08:45:39 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 26 May 2003 08:45:39 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Mon May 26 10:45:38 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 19KDbu-0001b5-00 for ; Mon, 26 May 2003 10:45:38 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.20) id 19KDba-0006rA-UL for gnu-help-gnu-emacs@m.gmane.org; Mon, 26 May 2003 04:45:18 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.icl.net!newsfeed.fjserv.net!feed.news.nacamar.de!fu-berlin.de!uni-berlin.de!lucy.is.informatik.uni-duisburg.DE!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 20 Original-NNTP-Posting-Host: lucy.is.informatik.uni-duisburg.de (134.91.35.216) Original-X-Trace: fu-berlin.de 1053938488 3190654 134.91.35.216 (16 [73968]) Mail-Copies-To: never User-Agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3.50 (gnu/linux) Cancel-Lock: sha1:NbuWyYXBrMJGKjtV0SqtvlRm6Jw= Original-Xref: shelby.stanford.edu gnu.emacs.help:113688 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:10183 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:10183 Wang Yin 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.