fdir
- list directory content

File Input/Output functions
(AmiBroker 5.70)


SYNTAX fdir( "wildcard", flags = 1 )
RETURNS STRING
FUNCTION The function returns comma separated directory list (like "DIR" command)

"wildcard" is a path with a wildcard pattern to match.

For example "C:\*.*" will give you all files in C: drive, but "C:\*.txt" will give you only files with .txt extension.

flags - controls what is returned the default is 1 - only files, 2 - only directories, 3 - both files and directories

EXAMPLE printf( "Only files: " );
_N( list = fdir( "c:\*.*", 1 ) );

for ( i = 0; ( filename = StrExtract( List, i ) ) != ""; i++ )
{
    
printf( filename + " " );
}

printf( " Only directories: " );

_N( list = fdir( "c:\*.*", 2 ) );

for ( i = 0; ( filename = StrExtract( List, i ) ) != ""; i++ )
{
    
printf( filename + " " );
}

printf( " Both files and directories: " );

_N( list = fdir( "c:\*.*", 3 ) );

for ( i = 0; ( filename = StrExtract( List, i ) ) != ""; i++ )
{
    
printf( filename + " " );
}
SEE ALSO

References:

The fdir function is used in the following formulas in AFL on-line library:

More information:

See updated/extended version on-line.