help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: traverse a directory


From: Xah Lee
Subject: Re: traverse a directory
Date: Wed, 2 Jan 2008 21:51:17 -0800 (PST)
User-agent: G2/1.0

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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]