unix - c copy file permissions from another file -
what's simplest way copy unix file permissions of file , set them file? there way store file's permissions variable , use variable set permissions file?
sure. use stat() , chmod() (may need root).
#include <sys/stat.h> struct stat st; stat("/foo/bar.txt", &st); chmod("/baz/quirk.jpg", st.st_mode);
Comments
Post a Comment