Created
February 19, 2021 20:37
-
-
Save ebresafegaga/457d236fa48656479a7de492e9098c60 to your computer and use it in GitHub Desktop.
Using OCaml unix library
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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