diff options
author | dianshi <dianshi@main.lv> | 2020-07-08 20:46:26 +0100 |
---|---|---|
committer | dianshi <dianshi@main.lv> | 2020-07-08 20:46:26 +0100 |
commit | 2e81ecf46d44b91bcdef35ef3e900554f3cb187c (patch) | |
tree | 76a2a5d025e58839183ad42736df236a29138d35 /ols | |
parent | e413daa66e0a987e92a3c9f936e01cb6e1150535 (diff) | |
download | osystem-2e81ecf46d44b91bcdef35ef3e900554f3cb187c.tar.gz osystem-2e81ecf46d44b91bcdef35ef3e900554f3cb187c.zip |
ols simple directory list
Diffstat (limited to 'ols')
-rw-r--r-- | ols/ols.ml | 25 |
1 files changed, 25 insertions, 0 deletions
@@ -0,0 +1,25 @@ +open Arg +open Unix +open Scanf +open Printf + +let main dir = + let _ = Printf.printf "list directory %s" dir in + let dirfd = opendir dir in + try + while true do + let fname = readdir dirfd in + Printf.printf "%s\n" fname + done + with End_of_file -> closedir dirfd + + +let num = Array.length Sys.argv +let _ = if num == 2 then + begin + (*Printf.printf "%s\n" Sys.argv.(1) *) + main Sys.argv.(1) + end + else + main "." + |