www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/04/07/14:31:43

Date: Wed, 5 Apr 2000 11:37:11 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Ben Davis <ben AT vjpoole DOT freeserve DOT co DOT uk>
cc: djgpp AT delorie DOT com
Subject: Re: Best way to implement DELTREE
In-Reply-To: <8ce9g4$nth$1@newsg4.svr.pol.co.uk>
Message-ID: <Pine.SUN.3.91.1000405113655.20661J-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019