moved back to old acc
[vox.git] / examples / walk.vx
blob9dc973a197724eb292910223e31cbb4b5538d3c1
2 function walk(dir, cb)
4     try
5     {
6         local files = os.listdir(dir)
7         foreach(path in files)
8         {
9             local fullpath = dir + "/" + path
10             local st = os.stat(fullpath)
11             cb(st.is_dir ? fullpath : dir, path, fullpath, st.is_dir, st)
12             if(st.is_dir)
13             {
14                 walk(fullpath, cb)
15             }
16         }
17     }
18     catch(err)
19     {}
22 walk(".", function(dir, path, fullpath, isdir, stat)
24     if(isdir)
25     {
26         println("dir %s:".fmt(dir.quote()))
27     }
28     println("    ", path)