From: Xah Lee <xah@xahlee.org>
To: help-gnu-emacs@gnu.org
Subject: Re: traverse a directory
Date: Wed, 2 Jan 2008 21:51:17 -0800 (PST) [thread overview]
Message-ID: <bf802645-6c07-46d6-b968-1067c1ff4c7f@d21g2000prf.googlegroups.com> (raw)
In-Reply-To: 873atgvxm7.fsf@W0053328.mgh.harvard.edu
about traversing a dir tree...
In Python, it's done with “walk”, 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
★ Perl-Python Tutorial: Traverse A Directory
http://xahlee.org/perl-python/traverse_dir.html
For unix, as you said, is “find” (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:
★ 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:
★ Sorting Tree Indexes
http://xahlee.org/tree/a-IndexSetSort.html
Xah
xah@xahlee.org
\xAD\xF4 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.
next prev parent reply other threads:[~2008-01-03 5:51 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-01 16:51 traverse a directory Xah Lee
2008-01-01 20:22 ` Eli Zaretskii
2008-01-02 5:43 ` Mike Mattie
[not found] ` <mailman.5612.1199252679.18990.help-gnu-emacs@gnu.org>
2008-01-02 18:03 ` Joel J. Adamson
2008-01-02 19:04 ` Mike Mattie
[not found] ` <mailman.5637.1199300789.18990.help-gnu-emacs@gnu.org>
2008-01-02 19:25 ` Joel J. Adamson
2008-01-03 5:51 ` Xah Lee [this message]
2008-01-03 11:16 ` Alexey Pustyntsev
2008-01-03 16:25 ` Joel J. Adamson
[not found] ` <bf802645-6c07-46d6-b968-1067c1ff4c7f@d21g2000prf.googlegro ups.com>
2008-01-05 17:47 ` OT: " Johan Lindström
2008-01-05 0:46 ` Mike Mattie
[not found] ` <mailman.5595.1199218943.18990.help-gnu-emacs@gnu.org>
2008-01-03 4:30 ` Xah Lee
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bf802645-6c07-46d6-b968-1067c1ff4c7f@d21g2000prf.googlegroups.com \
--to=xah@xahlee.org \
--cc=help-gnu-emacs@gnu.org \
/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.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.