Thank you this is usefull to make something better than my hold code.fxm wrote:Done.coderJeff wrote:There is already a good example on the wiki page. Maybe another shorter one?Code: Select all
#include once "dir.bi" '' allow everything var mask = fbDirectory or fbHidden or fbSystem or fbArchive or fbReadOnly var attrib = 0 var f = dir( "*.*", mask, attrib ) while( f > "" ) '' show any files that have directory attribute and don't '' care if it is system, hidden, read-only, or archive if( attrib and fbDirectory ) then print f end if f = dir( attrib ) wend
See the DIR documentation page for all updates.
[Solved] list Files and Directory with DIR()
Re: [Solved] list Files and Directory with DIR()
-
- Posts: 8586
- Joined: May 28, 2005 3:28
- Contact:
Re: [Solved] list Files and Directory with DIR()
Does fbSystem works on Linux also ?
/boot
/etc
/sbin
...
Joshy
/boot
/etc
/sbin
...
Joshy
Re: [Solved] list Files and Directory with DIR()
On Unix (src/rtlib/unix/file_dir.c):
So only character and block devices (e.g. probably everything under /dev), fifos and sockets are 'system'. Directories like /boot never are 'system'.
And non-directories always have the archive bit set (even if not regular files).
The way DIR works is pretty annoying IMO but everyone has always had to work with it the way it works. A while back I switched to using POSIX readdir() on Unix to get more control over things like symlinks and error checking. I'm going to have to stop using DIR on Windows too, to get unicode filenames.
Code: Select all
if( S_ISCHR( info->st_mode ) || S_ISBLK( info->st_mode ) || S_ISFIFO( info->st_mode ) || S_ISSOCK( info->st_mode ) )
attrib |= 0x4; /* system */
if( S_ISDIR( info->st_mode ) )
attrib |= 0x10; /* directory */
else
attrib |= 0x20; /* archive */
And non-directories always have the archive bit set (even if not regular files).
The way DIR works is pretty annoying IMO but everyone has always had to work with it the way it works. A while back I switched to using POSIX readdir() on Unix to get more control over things like symlinks and error checking. I'm going to have to stop using DIR on Windows too, to get unicode filenames.