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 "."