I made a c code to automatically copy a folder in an usb drive whenever you plug the stick in. In the "softwares that run at start" thing ( don't know the name in english), I added a new program, linked to the main.c class I made. But it obviously doesn't work. Ideas? (that's my first time doing this kind of things btw ;D)
Code, if it helps:
PS: I'm using Eclipse
EDIT: changed title of this thread
Code, if it helps:
Code:
#include <stdio.h>
#include <dirent.h>
#include <unistd.h>
#include <stdlib.h>
#define PATH "/media/dennis_orlando/ORLANDO D/Foto"
int main(){
int done = 0;
while (1== 1){
DIR *dir;
dir = opendir(PATH);
if (dir != NULL){
if (done == 0){
int a = system("echo password | cp -na '/media/dennis_orlando/ORLANDO D/Foto' '/home/dennis_orlando/Scrivania/'");
if (a == -1) printf("something went wrong while copying files");
else {
done = 1;
printf("\nsuccesfully copied files\n");
}
}
}
else done = 0;
sleep(1);
}
return 0;
}
PS: I'm using Eclipse
EDIT: changed title of this thread
Last edited: