|
|
Up |
|
|
  |
Author: Xah LeeXah Lee Date: Jan 1, 2008 08:51
if i want to recurse into a directory, do i have to write my own?
e.g. i want to apply a file processing function to all files in a dir
and subdirs. Somethnig like
(apply 'process-my-file "/Users/xah/emacs/" "\.html$")
I noticed that directory-files only list the dir file. Someone told me
there's a directory-files-recur but that doesn't seems to be in emacs.
thx in advance.
Xah
xah@ xahlee.org
|
| |
|
| | 8 Comments |
|
  |
Author: Eli ZaretskiiEli Zaretskii Date: Jan 1, 2008 12:22
> From: Xah Lee xahlee.org>
> Date: Tue, 1 Jan 2008 08:51:33 -0800 (PST)
>
> if i want to recurse into a directory, do i have to write my own?
Take a look at the package find-lisp.el, which is bundled with Emacs
22. It has infrastructure for what you want. In particular, there's
the `find-lisp-find-files-internal' function that recursively
traverses a directory.
|
| |
|
| | no comments |
|
  |
Author: Mike MattieMike Mattie Date: Jan 1, 2008 21:43
On Tue, 1 Jan 2008 08:51:33 -0800 (PST)
Xah Lee xahlee.org> wrote:
> if i want to recurse into a directory, do i have to write my own?
>
> e.g. i want to apply a file processing function to all files in a dir
> and subdirs. Somethnig like
>
> (apply 'process-my-file "/Users/xah/emacs/" "\.html$")
>
> I noticed that directory-files only list the dir file. Someone told me
> there's a directory-files-recur but that doesn't seems to be in emacs.
>
> thx in advance.
here is something kinda related that I recently hacked up. I needed to be able to
filter the results of a directory list. The first hack started off as a plain
defun but I encountered variations so I made a macro. it may duplicate existing
emacs code.
the elisp-in-path defun shows how the form is used. It's uncommented, and
relies upon map-filter-nil which needs to be non-recursive for general use.
|
| Show full article (3.26Kb) |
| no comments |
|
  |
Author: Joel J. AdamsonJoel J. Adamson Date: Jan 2, 2008 10:03
Mike Mattie gmail.com> writes:
> On Tue, 1 Jan 2008 08:51:33 -0800 (PST)
> Xah Lee xahlee.org> wrote:
>
>> if i want to recurse into a directory, do i have to write my own?
I know that doing this in Emacs is especially cool, but "find ... exec {}\;"
should do the trick.
Joel
--
Joel J. Adamson
Biostatistician
Pediatric Psychopharmacology Research Unit
Massachusetts General Hospital
Boston, MA 02114
(617) 643-1432
(303) 880-3109
|
| |
| no comments |
|
  |
Author: Mike MattieMike Mattie Date: Jan 2, 2008 11:04
On Wed, 02 Jan 2008 13:03:39 -0500
jadamson@ partners.org (Joel J. Adamson) wrote:
> Mike Mattie gmail.com> writes:
>
>> On Tue, 1 Jan 2008 08:51:33 -0800 (PST)
>> Xah Lee xahlee.org> wrote:
>>
>>> if i want to recurse into a directory, do i have to write my own?
>
> I know that doing this in Emacs is especially cool, but "find ...
> exec {}\;" should do the trick.
>
> Joel
>
cool maybe, but portable was my reason for doing it this way. BSD find is very different from gnu find.
some systems don't even have find. exec is a jungle, posix a mirage :)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
|
| Show full article (0.78Kb) |
| no comments |
|
  |
Author: Joel J. AdamsonJoel J. Adamson Date: Jan 2, 2008 11:25
Mike Mattie gmail.com> writes:
> On Wed, 02 Jan 2008 13:03:39 -0500
> jadamson@ partners.org (Joel J. Adamson) wrote:
>
>> Mike Mattie gmail.com> writes:
>>
>>> On Tue, 1 Jan 2008 08:51:33 -0800 (PST)
>>> Xah Lee xahlee.org> wrote:
>>>
>>>> if i want to recurse into a directory, do i have to write my own?
>>
>> I know that doing this in Emacs is especially cool, but "find ...
>> exec {}\;" should do the trick.
>>
>> Joel
>>
>
> cool maybe, but portable was my reason for doing it this way. BSD find
> is very different from gnu find.
|
| Show full article (0.93Kb) |
| no comments |
|
  |
Author: Alexey PustyntsevAlexey Pustyntsev Date: Jan 3, 2008 03:16
Xah Lee xahlee.org> writes:
> 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:
Dude, please, calm down. Relax.
|
| Show full article (0.71Kb) |
| no comments |
|
  |
Author: Joel J. AdamsonJoel J. Adamson Date: Jan 3, 2008 08:25
Xah Lee xahlee.org> writes:
> 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.
Really? I was unaware of that fact. Thanks for letting me know. I'll
keep it in mind.
Any other fucking fuck demented twisted crippled shit in the entire
universe you'd like to let me know about?
Thanks,
Joel
--
Joel J. Adamson
Biostatistician
Pediatric Psychopharmacology Research Unit
Massachusetts General Hospital
Boston, MA 02114
(617) 643-1432
(303) 880-3109
|
| |
| no comments |
|
  |
|
|
  |
Author: Johan LindströmJohan Lindström Date: Jan 5, 2008 09:47
At 04:51 2008-01-03, Xah Lee wrote:
>In Perl, it's done with File::Find qw(find), like this:
>find(\&myfun, $mydir);
>
>which is quite fucked up.
|
| |
| no comments |
|
|