Re: How to get list of output of find command of Linux

new topic     » goto parent     » topic index » view thread      » older message » newer message
rneu said...

A walk_dir() approach code here will be really illustrative and helpful.

It's pretty simple

sequence files = {} 
function look_at(sequence path, sequence d) 
    files = append(files,{join_path({path,d[D_NAME]}),d[D_SIZE]}) 
    return 0 -- keep going 
end function 
if walk_dir("C:\\Downloads\\Software", routine_id("look_at"), TRUE)!=0 then 
    ?"oops" 
end if 
for i=1 to length(files) do 
    printf(1, "%s: %d\n",files[i]) 
end for 

Output:

<snip> 
C:\Downloads\Software\SKU322505 inpa\inpa\InpaCANinstall.doc: 4561920 
C:\Downloads\Software\SKU322505 inpa\inpa\InpaCANinstall.pdf: 300349 
C:\Downloads\Software\SKU322505 inpa\inpa\autorun.inf: 60 
C:\Downloads\Software\SKU322505 inpa\inpa\cemtl.ico: 4286 
C:\Downloads\Software\tdm-gcc-5.1.0-3.exe: 36802006 
C:\Downloads\Software\tdm64-gcc-5.1.0-2.exe: 48071122 

For a fuller example, see http://openeuphoria.org/docs/std_filesys.html#_1282_walk_dir

Pete

PS: you'll probably also need include std/filesys.e at the top

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

Search



Quick Links

User menu

Not signed in.

Misc Menu