English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
[Caml-list] file copy
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-06-23 (19:21)
From: sylvain.le-gall@p...
Subject: Re: [Caml-list] file copy
On Wed, Jun 23, 2004 at 03:55:19PM +0000, Sebastien Ferre wrote:
> Hi,
> is there any function in OCaml for copying a file
> like with the Unix command 'cp' ? I wish to avoid
> using the function Sys.command to keep platform
> independency.
> I could not find any neither in the standard library,
> nor in the Unix library.

You can use the library i am developping : ocaml-fileutils.

It allows you to do 'cp' and a lot of other operation ( 'mv', 'ls', 'find', 'rm'... )

Moreover, you can do cp ~recurse:true to copy whole directory.

Least but not last, all the function should be platform independent,
regarding filename, because it use filePath which is a wrapper for
filename of the platform ( support : Unix, MacOs, Win32, Cygwin style ).

Actually, i am writing unitary test in order to release version 0.3,
which comes with operation on file size ( 'du', + test for find ), loop
prevention ( if you have a symlink from 'x' to '.', it won't recurse ).
It also changes some prototype : rm, cp will now use list as argument.

It also fixes some bugs. This new version will be available friday or

Anyway, the current version should be enough for your usage ( and for
two days ).

Kind regard
Sylvain Le Gall

ps : http://www.carva.org/sylvain.le-gall/

To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners