forum-msg-id-133515-edit

Original date:2019-01-23 15:44:03 Edited by: irv Subject: Re: First letter of dir() result

If you wish to build a filter which can do this, plus is easily expandable to do other things:

include std/filesys.e 
include std/console.e 
include std/sequence.e 
 
object files = dir("/home/irv") 
 
files = vslice(filter(files,routine_id("filefilter")),D_NAME) 
 -- vslice gives us just the names 
 
display(files) 
 
function filefilter(object x, object y)  
if equal(x[D_NAME][1],'.')  -- remove hidden files; 
or equal(x[D_NAME],".")     -- remove dot files 
or equal(x[D_NAME],"..") 
or equal(x[D_ATTRIBUTES],"d") then return 0  
end if 
return 1 
end function 
Not Categorized, Please Help

Search



Quick Links

User menu

Not signed in.

Misc Menu