CONTACT
Christopher M. Howard
home page: <https://frigidcode.com/code/rremove/>
e-mail: <christopher.howard@frigidcode.com>

I am interested in receiving bug reports, build problems, feature requests, and so forth, though I may not be able to respond directly to every e-mail. Do not send any code unless you intend for it to be released with this program under the terms of the GPLv3 license and the code can legally be included under those terms.

LICENSE

LGPLv3. Refer to the COPYING and COPYING.LESSER files for the full text of the license.

MOTIVATION

The idea behind the Recursive Remove Library is quite straitforward: to let you recursively delete a non-empty directory on a *nix system, without having to 1) make an external call to the "rm" utility; 2) write your own procedure from scratch; or 3) switch to C++ and use some ginormous programming framework.

If you need a procedure that is super-optimized or performs some special operation on each visited file, you probably want to write your own.

HOW IT WORKS

Nothing particularly clever here. You pass in a path to the rremove function, some flags, and a destination stream for error messages. The function does a post-order traversal with nftw(), deleting files and directories as it goes, using the remove() function from stdio.

rremove does a physical walk, meaning that it will not follow symbolic links, but will simply delete the symbolic links.

WARNINGS

N.B.: rremove is NOT reentrant or thread-safe. Especially do not change the current working directory while it is working. Any individual recursive removal operation may be subject to the usual race conditions for the handling of multiple file paths in a heirarchy.

USAGE

Please see the included RREMOVE(3) manual page for usage details and examples.

PORTABILITY

I wrote this source targeting the C99 standard, but also utilizing _XOPEN_SOURCE 700 features (POSIX.1, POSIX.2, XPG4, SUSv4).

