mirror of
https://github.com/vlang/v.git
synced 2025-08-03 17:57:59 -04:00
15 lines
303 B
V
15 lines
303 B
V
import os
|
|
|
|
// Example usage of os.ls (in the form of top-level statements)
|
|
println('readdir example using os.ls')
|
|
|
|
entries := os.ls(os.home_dir()) or { [] }
|
|
|
|
for entry in entries {
|
|
if os.is_dir(os.join_path(os.home_dir(), entry)) {
|
|
println('dir: ${entry}')
|
|
} else {
|
|
println('file: ${entry}')
|
|
}
|
|
}
|