GRASS GIS 7 Programmer's Manual  7.5.svn(2017)-r71806
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
remove.c File Reference

GIS Library - File remove functions. More...

#include <grass/config.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <dirent.h>
#include <grass/gis.h>
Include dependency graph for remove.c:

Go to the source code of this file.

Functions

int G_remove (const char *element, const char *name)
 Remove a database file. More...
 
int G_remove_misc (const char *dir, const char *element, const char *name)
 Remove a database misc file. More...
 
int G_recursive_remove (const char *path)
 Recursively remove all files in given directory. More...
 

Detailed Description

GIS Library - File remove functions.

(C) 2001-2009 by the GRASS Development Team

This program is free software under the GNU General Public License (>=v2). Read the file COPYING that comes with GRASS for details.

Author
Original author CERL

Definition in file remove.c.

Function Documentation

int G_recursive_remove ( const char *  path)

Recursively remove all files in given directory.

Equivalent to rm -rf path.

Parameters
pathpath to the directory which should be removed
Returns
0 on success
-1 on error

Definition at line 113 of file remove.c.

References G_lstat(), GPATH_MAX, NULL, opendir(), and readdir().

Referenced by V1_close_nat().

int G_remove ( const char *  element,
const char *  name 
)

Remove a database file.

The file or directory name under the database element directory in the current mapset is removed.

If name is a directory, everything within the directory is removed as well.

Parameters
elementelement name
namefile name
Returns
0 if name does not exist
1 if successful
-1 on error

Definition at line 44 of file remove.c.

References NULL.

Referenced by G_remove_vector_timestamp(), M_do_copy(), M_do_remove(), M_do_rename(), Rast__quant_export(), Rast_remove_colors(), Rast_write_colors(), and Vect_remove_colors().

int G_remove_misc ( const char *  dir,
const char *  element,
const char *  name 
)

Remove a database misc file.

The file or directory name under the database element directory in the current mapset is removed.

If name is a directory, everything within the directory is removed as well.

Parameters
elementelement name
namefile name
Returns
0 if name does not exist
1 if successful
-1 on error

Definition at line 65 of file remove.c.

Referenced by G_remove_raster3d_timestamp(), G_remove_raster_timestamp(), Rast3d_remove_color(), Rast__quant_export(), Rast__remove_fp_range(), Rast_remove_histogram(), Rast_write_fp_range(), and Rast_write_range().