1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00
v/examples/file_list.v

19 lines
263 B
V
Raw Normal View History

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()
}