if (stat (path, &st) == 0)
char fullpath[_POSIX_PATH_MAX];  snprintf (fullpath, sizeof (fullpath), "%s/%s", folder, path);  if (stat (fullpath, &st) == 0)
static int link_is_dir (const char *path){  struct stat st;  if (stat (path, &st) == 0)    return (S_ISDIR (st.st_mode));  else    return (-1);}