Violaine & Sylvain Website

Aller au contenu | Aller au menu | Aller à la recherche

ocaml-fileutils project


ocaml-fileutils is a library to provide pure OCaml functions to manipulate real file and filename.

Requirements of the project:

  • pure OCaml

  • real file functions inspired from GNU fileutils

  • only Win32 and POSIX compatible


This version features the following functions, inspired from GNU fileutils:

  • cp: copy files

  • mv: rename files

  • rm: remove files and directories

  • test: check file types and compare values

  • find: find files that match certain criteria

  • mkdir: create directory and its parents

  • ls: list content of a directory

  • touch: change file timestamps

  • which: locate a command

  • readlink: resolve symlink

  • du: compute disk usage

  • stat: abstract of Unix.stat

  • cmp: compare files

It also contains function to manipulate filename, using different OS scheme:

  • Supported OS:

    • Win32

    • Unix

    • MacOS

    • Cygwin

  • Functions:

    • Compare: is_subdir, is_updir, compare

    • Transform: make_absolute, make_relative, reduce

    • Extension: chop_extension, check_extension


Version 0.4.0

This is a major rewrite to simplify module structure. Now the most useful functions are directly accessible with a simple "open", no more nested module required.

It also improve speed for find on Unix. At least on this system, FileUtil.find only takes 2x time of "find" command (idea to improve this are welcome).

This version is not compatible with former version, but changes should be restricted to module name change. See CHANGELOG for more details.

Version 0.3.0

Add some features:

  • Functions: cmp, du, stat, readlink

  • Find takes a function as argument: more flexible and allow processing huge number of file.

  • Avoid recursion when processing symlink.

  • Operations on file size

Version 0.2.0

First public version, test and benchmark on different system are welcome.