gaucheノート  ディレクトリをたどる

[tigerii@fedora ~]$ rlwrap gosh
gosh> (use file.util)
#<undef>
gosh> (define (myfind path)
  (cond ( (not (file-exists? path))
          (print path " not found."))
        ((file-is-directory? path)
          (print path)
          (for-each myfind (directory-list path :add-path? #t :children? #t)))
        (else (print path))))
myfind
gosh> (myfind "./test")
./test
./test/a
./test/a/d.txt
./test/b
./test/b/e.txt
./test/b/f.txt
./test/c
./test/c/g.txt
#<undef>
gosh> (exit)
[tigerii@fedora ~]$ find ./test
./test
./test/b
./test/b/e.txt
./test/b/f.txt
./test/c
./test/c/g.txt
./test/a
./test/a/d.txt
[tigerii@fedora ~]$


参照したURL:
file.util - ファイルシステムユーティリティ
http://practical-scheme.net/gauche/man/gauche-refj_137.html#g_t_00e3_0083_0095_00e3_0082_00a1_00e3_0082_00a4_00e3_0083_00ab_00e3_0082_00b7_00e3_0082_00b9_00e3_0083_0086_00e3_0083_00a0_00e3_0083_00a6_00e3_0083_00bc_00e3_0083_0086_00e3_0082_00a3_00e3_0083_00aa_00e3_0083_0086_00e3_0082_00a3
ファイルの状態
http://practical-scheme.net/gauche/man/gauche-refj_61.html#g_t_00e3_0083_0095_00e3_0082_00a1_00e3_0082_00a4_00e3_0083_00ab_00e3_0081_00ae_00e7_008a_00b6_00e6_0085_008b
for-each
http://karetta.jp/book-node/gauche-hacks/006963