STASIS
A pipeline delivery generator
Loading...
Searching...
No Matches
copy.h File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <dirent.h>
#include <errno.h>
#include <sys/stat.h>
#include <unistd.h>
#include "core.h"
Include dependency graph for copy.h:

Go to the source code of this file.

Macros

#define CT_OWNER   1 << 1
 
#define CT_PERM   1 << 2
 

Functions

int copy2 (const char *src, const char *dest, unsigned op)
 

Function Documentation

◆ copy2()

int copy2 ( const char * src,
const char * dest,
unsigned op )

Copy a single file

if (copy2("/source/path/example.txt", "/destination/path/example.txt", CT_PERM | CT_OWNER)) {
fprintf(stderr, "Unable to copy file\n");
exit(1);
}
int copy2(const char *src, const char *dest, unsigned op)
Parameters
srcsource file path
destdestination file path
opCT_OWNER (preserve ownership)
opCT_PERM (preserve permission bits)
Returns
0 on success, -1 on error