Trying to check if target exit with stat
struct stat target_exist;
    stat(target, &target_exist);
    if(stat(target, &target_exist) != 0){
        perror("target non-existent");
        exit(1);
    }