From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Xah Lee Newsgroups: gmane.emacs.help Subject: Re: traverse a directory Date: Wed, 2 Jan 2008 21:51:17 -0800 (PST) Organization: http://groups.google.com Message-ID: References: <5f20a79c-c1fc-4853-b55f-657f6d66f0e9@l6g2000prm.googlegroups.com> <87prwkw1dw.fsf@W0053328.mgh.harvard.edu> <873atgvxm7.fsf@W0053328.mgh.harvard.edu> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-2022-JP Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1199342444 4453 80.91.229.12 (3 Jan 2008 06:40:44 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 3 Jan 2008 06:40:44 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Jan 03 07:40:58 2008 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1JAJlB-0001ue-9z for geh-help-gnu-emacs@m.gmane.org; Thu, 03 Jan 2008 07:40:57 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JAJkp-00056x-5F for geh-help-gnu-emacs@m.gmane.org; Thu, 03 Jan 2008 01:40:35 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!postnews.google.com!d21g2000prf.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 51 Original-NNTP-Posting-Host: 64.9.239.250 Original-X-Trace: posting.google.com 1199339477 7769 127.0.0.1 (3 Jan 2008 05:51:17 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Thu, 3 Jan 2008 05:51:17 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: d21g2000prf.googlegroups.com; posting-host=64.9.239.250; posting-account=qPxGtQkAAADb6PWdLGiWVucht1ZDR6fn User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/523.12.2 (KHTML, like Gecko) Version/3.0.4 Safari/523.12.2, gzip(gfe), gzip(gfe) Original-Xref: shelby.stanford.edu gnu.emacs.help:155023 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:50445 Archived-At: about traversing a dir tree... In Python, it's done with $B!H(Bwalk$B!I(B, like this: os.path.walk(mydir, myfun, 'somenull') In Perl, it's done with File::Find qw(find), like this: find(\&myfun, $mydir); which is quite fucked up. For details on Python and Perl's dir traverse, see $B!z(B Perl-Python Tutorial: Traverse A Directory http://xahlee.org/perl-python/traverse_dir.html For unix, as you said, is $B!H(Bfind$B!I(B (with exec or xargs), which is the most fucking fuck demented twisted crippled shit in the entire universe. (This point is particularly interesting because most senior unix sys admins and don't realize it but actually thought its godsend) For more, see: $B!z(B Unix Command Line Tools Tips http://xahlee.org/UnixResource_dir/unix_tips.html Emacs lisp's (require 'find-lisp) (mapcar 'myfun (find-lisp-find-files mydir)) Is the most beautiful among these. For a general treatise on sorting tree nodes (i.e. the order of visiting), see: $B!z(B Sorting Tree Indexes http://xahlee.org/tree/a-IndexSetSort.html Xah xah@xahlee.org $B-t(B http://xahlee.org/ On Jan 2, 11:25 am, jadam...@partners.org (Joel J. Adamson) wrote: >... > > cool maybe, but portable was my reason for doing it this way. BSD find > > is very different from gnu find. > > So I've heard: should I go ahead with installing FreeBSD? > > > some systems don't even have find. exec is a jungle, posix a mirage :) > > Some systems I've found aren't systematic.