-------------------- -------------------- -------------------- -------

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
//------------------------------------------------------------------------------------------
u8 get_all_directory_file (u16 num_file)
{
u16 s=0;
#if _USE_LFN
static char lfn[_MAX_LFN * (0 ? 2 : 1) + 1];
Fno.lfname = lfn;
Fno.lfsize = sizeof(lfn);
#endif
res = f_opendir(&Dir, "/");
for (;;)
{
res = f_readdir(&Dir, &Fno); /* cчитаем директорию*/
if (res != FR_OK)
{
return 0; /* конец директории*/
break;
}
if (Fno.fname[0] == 0)
{
return 0;
break;
} // нет файлов
if (Fno.fname[0] == '.') continue; /* Ignore dot entry */
#if _USE_LFN
fn = *Fno.lfname ? Fno.lfname : Fno.fname;
filesize=Fno.fsize;
//fn = Fno.fname;
#else fn = Fno.fname;
#endif
if (Fno.fattrib == AM_DIR) strcat(fn," DIR");
s++;
if (s == num_file){break;}
}
return 1;
}
//------------------------------------------------------------------------------------------------