aboutsummaryrefslogtreecommitdiff
path: root/v_windows/v/examples/file_list.v
blob: b1dc2958f9869db291c85e3d791c2324693cf9da (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import os

fn main() {
	files := os.ls('.') or {
		println(err)
		return
	}
	mut f := os.create('file_list.txt') or {
		println(err)
		return
	}
	for file in files {
		if os.is_file(file) {
			f.write_string(file + '\r\n') or { println(err) }
		}
	}
	f.close()
}