Re: First letter of dir() result

new topic     » goto parent     » topic index » view thread      » older message » newer message

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

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu