// retoor <retoor@molodetz.nl>
|
|
|
|
import "pathlib" for Path
|
|
|
|
var base = Path.new("/tmp/wren_pathlib_test_glob")
|
|
if (base.exists()) base.rmtree()
|
|
base.mkdir(true)
|
|
|
|
(base / "a.txt").writeText("a")
|
|
(base / "b.txt").writeText("b")
|
|
(base / "c.md").writeText("c")
|
|
var sub = base / "sub"
|
|
sub.mkdir()
|
|
(sub / "d.txt").writeText("d")
|
|
|
|
var txtFiles = base.glob("*.txt")
|
|
System.print(txtFiles.count) // expect: 2
|
|
|
|
var allTxt = base.rglob("*.txt")
|
|
System.print(allTxt.count) // expect: 3
|
|
|
|
base.rmtree()
|