package fileutils

  1. Overview
  2. Docs
exception FileDoesntExist of FilePath.filename
type !'a error_handler = string -> 'a -> unit
exception Fatal of string
type interactive =
  1. | Force
  2. | Ask of FilePath.filename -> bool
type base_permission = {
  1. sticky : bool;
  2. exec : bool;
  3. write : bool;
  4. read : bool;
}
type permission = {
  1. user : base_permission;
  2. group : base_permission;
  3. other : base_permission;
}
val permission_of_int : int -> permission
val int_of_permission : permission -> int
module Mode : sig ... end
type size =
  1. | TB of int64
  2. | GB of int64
  3. | MB of int64
  4. | KB of int64
  5. | B of int64
val byte_of_size : size -> int64
val size_add : size -> size -> size
val size_compare : ?fuzzy:bool -> size -> size -> int
val string_of_size : ?fuzzy:bool -> size -> string
type kind =
  1. | Dir
  2. | File
  3. | Dev_char
  4. | Dev_block
  5. | Fifo
  6. | Socket
type stat = {
  1. kind : kind;
  2. permission : permission;
  3. size : size;
  4. owner : int;
  5. group_owner : int;
  6. access_time : float;
  7. modification_time : float;
  8. creation_time : float;
  9. device : int;
  10. inode : int;
}
val stat : ?dereference:bool -> FilePath.filename -> stat
exception UmaskError of string
type umask_error = [
  1. | `Exc of exn
  2. | `NoStickyBit of int
]
val umask : ?error:umask_error error_handler -> ?mode:[< `Octal of int | `Symbolic of Mode.t ] -> [< `Octal of int -> 'a | `Symbolic of Mode.t -> 'a ] -> 'a
val umask_apply : int -> int
type test_file =
  1. | Is_dev_block
  2. | Is_dev_char
  3. | Is_dir
  4. | Exists
  5. | Is_file
  6. | Is_set_group_ID
  7. | Has_sticky_bit
  8. | Is_pipe
  9. | Is_readable
  10. | Is_writeable
  11. | Size_not_null
  12. | Size_bigger_than of size
  13. | Size_smaller_than of size
  14. | Size_equal_to of size
  15. | Size_fuzzy_equal_to of size
  16. | Is_socket
  17. | Has_set_user_ID
  18. | Is_exec
  19. | Is_owned_by_user_ID
  20. | Is_owned_by_group_ID
  21. | Is_newer_than of FilePath.filename
  22. | Is_older_than of FilePath.filename
  23. | Is_newer_than_date of float
  24. | Is_older_than_date of float
  25. | And of test_file * test_file
  26. | Or of test_file * test_file
  27. | Not of test_file
  28. | Match of string
  29. | True
  30. | False
  31. | Has_extension of FilePath.extension
  32. | Has_no_extension
  33. | Is_parent_dir
  34. | Is_current_dir
  35. | Basename_is of FilePath.filename
  36. | Dirname_is of FilePath.filename
  37. | Custom of FilePath.filename -> bool
val test : ?match_compile:(FilePath.filename -> FilePath.filename -> bool) -> test_file -> FilePath.filename -> bool
exception ChmodError of string
type chmod_error = [
  1. | `Exc of exn
]
val chmod : ?error:chmod_error error_handler -> ?recurse:bool -> [< `Octal of Unix.file_perm | `Symbolic of Mode.t ] -> FilePath.filename list -> unit
exception MkdirError of string
type mkdir_error = [
  1. | `DirnameAlreadyUsed of FilePath.filename
  2. | `Exc of exn
  3. | `MissingComponentPath of FilePath.filename
  4. | `MkdirChmod of FilePath.filename * Unix.file_perm * string * chmod_error
]
val mkdir : ?error:mkdir_error error_handler -> ?parent:bool -> ?mode:[< `Octal of Unix.file_perm | `Symbolic of FileUtilMode.t ] -> FilePath.filename -> unit
exception RmError of string
type rm_error = [
  1. | `DirNotEmpty of FilePath.filename
  2. | `Exc of exn
  3. | `NoRecurse of FilePath.filename
]
val rm : ?error:rm_error error_handler -> ?force:interactive -> ?recurse:bool -> FilePath.filename list -> unit
exception CpError of string
type cp_error = [
  1. | `CannotChmodDstDir of FilePath.filename * exn
  2. | `CannotCopyDir of FilePath.filename
  3. | `CannotCopyFilesToFile of FilePath.filename list * FilePath.filename
  4. | `CannotCreateDir of FilePath.filename * exn
  5. | `CannotListSrcDir of FilePath.filename * exn
  6. | `CannotOpenDstFile of FilePath.filename * exn
  7. | `CannotOpenSrcFile of FilePath.filename * exn
  8. | `CannotRemoveDstFile of FilePath.filename * exn
  9. | `DstDirNotDir of FilePath.filename
  10. | `ErrorRead of FilePath.filename * exn
  11. | `ErrorWrite of FilePath.filename * exn
  12. | `Exc of exn
  13. | `NoSourceFile of FilePath.filename
  14. | `PartialWrite of FilePath.filename * int * int
  15. | `SameFile of FilePath.filename * FilePath.filename
  16. | `UnhandledType of FilePath.filename * kind
]
val cp : ?follow:action_link -> ?force:interactive -> ?recurse:bool -> ?preserve:bool -> ?error:cp_error error_handler -> FilePath.filename list -> FilePath.filename -> unit
exception MvError of string
type mv_error = [
  1. | `Exc of exn
  2. | `MvCp of FilePath.filename * FilePath.filename * string * cp_error
  3. | `MvRm of FilePath.filename * string * rm_error
  4. | `NoSourceFile
]
val mv : ?error:mv_error error_handler -> ?force:interactive -> FilePath.filename -> FilePath.filename -> unit
type touch_time_t =
  1. | Touch_now
  2. | Touch_file_time of FilePath.filename
  3. | Touch_timestamp of float
val touch : ?atime:bool -> ?mtime:bool -> ?create:bool -> ?time:touch_time_t -> FilePath.filename -> unit
val filter : test_file -> FilePath.filename list -> FilePath.filename list
val pwd : unit -> FilePath.filename
val cmp : ?skip1:int -> FilePath.filename -> ?skip2:int -> FilePath.filename -> int option
val du : FilePath.filename list -> size * (FilePath.filename * size) list
val find : ?follow:action_link -> ?match_compile:(FilePath.filename -> FilePath.filename -> bool) -> test_file -> FilePath.filename -> ('a -> FilePath.filename -> 'a) -> 'a -> 'a
OCaml

Innovation. Community. Security.