Skip to content

Instantly share code, notes, and snippets.

@ebresafegaga
Created February 19, 2021 20:37
Show Gist options
  • Save ebresafegaga/457d236fa48656479a7de492e9098c60 to your computer and use it in GitHub Desktop.
Save ebresafegaga/457d236fa48656479a7de492e9098c60 to your computer and use it in GitHub Desktop.
Using OCaml unix library
let (>>) f g a = a |> f |> g
let list_all = Sys.readdir >> Array.to_list >> List.filter Sys.is_directory
let rec read_all handle =
match Unix.readdir handle with
| "." | ".." -> read_all handle
| item -> item :: read_all handle
| exception End_of_file -> []
let d = Unix.getcwd >> Unix.opendir >> read_all
let exec =
List.filter Sys.is_directory >>
List.concat_map (fun dir ->
dir
|> Unix.opendir
|> read_all
|> List.map (Filename.concat dir)) >>
List.iter (fun file ->
(*if Filename.check_suffix ".cmo" file then
Sys.remove file*)
print_endline file)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment