emacs-devel
[Top][All Lists]
Advanced

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

Re: recursing through directories


From: Paul Eggert
Subject: Re: recursing through directories
Date: Mon, 22 Apr 2002 11:09:30 -0700 (PDT)

> From: Francesco Potorti` <address@hidden>
> Date: Mon, 22 Apr 2002 16:48:32 +0200
> 
> Looking at the libc functions, I think that scandir is the most useful
> for this job.  Is it standard enough?

Not really, unfortunately.  ftw is standard, but it's a portability
hassle too.  In practice, there are real problems in running out of
file descriptors when descending into deeply nested directories.

You might try taking a look at lib/savedir.[ch] from the GNU core
utilities, written by David MacKenzie.
<ftp://alpha.gnu.org/gnu/fetish/fileutils-4.1.8.tar.gz>
It's what I use in GNU tar.  Here's a precis:

  char *name_space = savedir (dir);
  if (! name_space)
    report_error (errno, dir);
  else
    {
      char *base;
      for (base = name_space; *base; base += strlen (base) + 1)
        operate_on (string_concat (dir, "/", base));
      free (name_space);
    }



reply via email to

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