Enviado em 22/10/2018 - 18:25h
Olá a todos!{
struct dirent **namelist;
int n,i;
if (!entry || !container)
return;
n = scandir (container, &namelist, 0, alphasort);
if (n < 0)
{
perror ("scandir");
return;
}
for (i = 0; i < n; i++)
{
struct stat st;
char *fullpath = NULL;
if (namelist[i]->d_name[0] == '.')
{
free (namelist[i]);
continue;
}
fullpath = (char *)
malloc (strlen (container) + strlen (namelist[i]->d_name) + 2);
sprintf (fullpath, "%s/%s", container, namelist[i]->d_name);
log_verbose ("%s\n", fullpath);
if (stat (fullpath, &st) < 0)
{
free (namelist[i]);
free (fullpath);
continue;
}
if (S_ISDIR (st.st_mode))
{
struct upnp_entry_t *child = NULL;
child = upnp_entry_new (ut, namelist[i]->d_name,
fullpath, entry, 0, true);
if (child)
{
metadata_add_container (ut, child, fullpath);
upnp_entry_add_child (ut, entry, child);
}
}
else
metadata_add_file (ut, entry, fullpath, namelist[i]->d_name, &st);
free (namelist[i]);
free (fullpath);
}
free (namelist);
}
Atualizando o Passado: Linux no Lenovo G460 em 2025
aaPanel - Um Painel de Hospedagem Gratuito e Poderoso
O macete do Warsaw no Linux Mint e cia
Visualizar arquivos em formato markdown (ex.: README.md) pelo terminal
Dando - teoricamente - um gás no Gnome-Shell do Arch Linux
Como instalar o Google Cloud CLI no Ubuntu/Debian
Mantenha seu Sistema Leve e Rápido com a Limpeza do APT!
Procurando vídeos de YouTube pelo terminal e assistindo via mpv (2025)
Pastas da raiz foram para a área de trabalho [RESOLVIDO] (11)
Será que eu deveria apreender C/C++ para desenvolver para Linux? (4)