Mail Archives: djgpp/2000/04/07/14:31:43
On Wed, 5 Apr 2000, Ben Davis wrote:
> Eli Zaretskii wrote in message <38EA1EA7 DOT 6A8E81BE AT is DOT elta DOT co DOT il>...
> >You can use the directory-traversal functions provided in the library. The
> >function `ftw' is portable to Unix systems; the function `__file_tree_walk'
> >is DJGPP-specific, but is usually much faster. Look them up in the library
> >docs.
>
> I've considered that, but they both check directories before they check the
> subdirectories. If I'm deleting, I need to empty a directory before I remove
> it.
That's not really a problem: you could save the directory name and
remove it when the last of its files is removed. The library
implementation of the `rename' function (which can move directory
trees) uses this method. If you want a portable program that uses
`ftw', this is the way to go, because `ftw' examines directories
before its files on other systems as well.
Alternatively, you could trivially modify the code of these functions
to examine the directory at the end. The sources are freely
available.
> By the way, I don't think 'siblings' is the right word, as used in the docs
> and the source
Yes, it should be replaced with "descendances".
- Raw text -