Directory Tree Removal Library Module

The directory tree removal library module has the file name armtree.c. This module will remove an entire directory tree from a disk. Be very careful with this API. You can easily delete the entire contents of the disk by starting the deletion from the root of the drive.

This API uses the directory scanning API to navigate through the directory tree.

This API makes two passes through the directory tree. The first pass deletes all the files and stores all directory names in a link list (new entries are added to the top of the list [lifo]). The second pass goes through the link list from the top and deletes all the directories.

This API is mutli-platform and will compile in any environment that supports the POSIX 1003.1 directory system calls which are used by the directory scanning API.

This API has been built to use the logging manager if active.

Here is a list of functions in the directory tree removal library module:

- rmtree
- armtree_delete_dirs
- armtree_ll_add
- armtree_ll_delete
- armtree_ll_debug

# Module Dependencies

The following modules are required along with this module:

- fio.c
- parse.c
- logger.c
- logman.c
- dscan.c

# Module Header Files

This module requires the header files:

- stdhead.h
- dscan.h
- armtree.h

# Module Functions

## rmtree

    Prototype  : int rmtree(char *path)
    Parameters :
          Name : path
    Description: starting directory

    Returns    : TRUE upon success, FALSE otherwise

This function will delete all files and directories from the starting directory down. The starting directory must be expressed in absolute form.

## armtree_delete_dirs

    Prototype  : static int armtree_delete_dirs(void)

    Returns    : TRUE upon success, FALSE otherwise

This private function will delete all entries in the link list.

## armtree_ll_add

    Prototype  : static int armtree_ll_add(char *dirname)
    Parameters :
          Name : dirname
    Description: directory name

    Returns    : TRUE upon success, FALSE otherwise

This private function will add the directory name to the link list. The new entry will be placed at the top of the list.

## armtree_ll_delete

    Prototype  : void armtree_ll_delete(void)

This private function will delete a single directory entry from the link list.

## armtree_ll_debug

    Prototype  : void armtree_ll_debug(void)

This private function will output the contents of the link list using the logging manager. The logging manager must first be active.

Goto Top | GPL Software Overview | GPL Library
Future Lab Home | Contact Webmaster | Feedback

Copyright © 2005-2006 Future Lab, Last Updated Jun 30, 2006