GRASS GIS 8 Programmer's Manual
8.5.0dev(2024)-d6dec75dd4
|
GIS Library - function to recursively copy a directory. More...
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <grass/gis.h>
#include <fcntl.h>
#include <unistd.h>
#include <dirent.h>
#include <sys/types.h>
#include <sys/stat.h>
Go to the source code of this file.
Functions | |
int | G_recursive_copy (const char *src, const char *dst) |
Copy recursively source directory to destination directory. More... | |
GIS Library - function to recursively copy a directory.
Extracted from general/manage/lib/do_copy.c
(C) 2008-2015 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.
Definition in file copy_dir.c.
int G_recursive_copy | ( | const char * | src, |
const char * | dst | ||
) |
Copy recursively source directory to destination directory.
RULE:
This rule is designed according to general/manage/lib/copy.sh.
POSSIBLE CASES:
* if src is a file: * if dst does not exist: * copy src to dst RULE 1 * if dst is a file: * delete dst and copy src to dst RULE 2 * if dst is a directory: * try recursive_copy(src, dst/src) RULE 3 * if src is a directory: * if dst does not exist: * copy src to dst RULE 1 * if dst is a file: * delete dst and copy src to dst RULE 2 * if dst is a directory: * try RULE 4 * for i in `ls src` * do * recursive_copy(src/$i, dst/$i) * done *
src | source directory |
dst | destination directory |
Definition at line 70 of file copy_dir.c.
References dst, G_lstat(), G_mkdir(), G_recursive_copy(), GPATH_MAX, and src.
Referenced by G_recursive_copy(), M_do_copy(), and V1_close_nat().