Re: First letter of dir() result
- Posted by ghaberek (admin) Jan 23, 2019
- 1059 views
I'd say this is the best-practice approach:
object files = dir( path ) if atom( files ) then -- report error, exit end if for i = 1 to length( files ) do sequence file_name = files[i][D_NAME] if find( file_name, {".",".."} ) then -- skip current/parent directory continue end if end for
And if you want to skip hidden files, add this:
sequence file_attr = files[i][D_ATTRIBUTES] if file_name[1] = '.' or find( 'h', file_attr ) then -- skip hidden files continue end if
-Greg