From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id VAA02826; Wed, 23 Jun 2004 21:21:13 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id VAA02354 for ; Wed, 23 Jun 2004 21:21:12 +0200 (MET DST) From: sylvain.le-gall@polytechnique.org Received: from corwin.easynet.fr (smarthost2.mail.easynet.fr [212.180.1.69]) by concorde.inria.fr (8.12.10/8.12.10) with ESMTP id i5NJLBSH008147 for ; Wed, 23 Jun 2004 21:21:11 +0200 Received: from asi-62.asi256ip.easynet.fr ([212.180.39.62] helo=gros) by corwin.easynet.fr with esmtp (Exim 4.34) id 1BdDJ1-0006Kf-C7; Wed, 23 Jun 2004 21:21:11 +0200 Received: from ptit ([192.168.0.11] helo=ptit.gallu.homelinux.org) by gros with esmtp (Exim 3.36 #1 (Debian)) id 1BdDJ0-0002rA-00; Wed, 23 Jun 2004 21:21:10 +0200 Received: from gildor by ptit.gallu.homelinux.org with local (masqmail 0.2.20) id 1BdDIx-0ka-00; Wed, 23 Jun 2004 21:21:07 +0200 Date: Wed, 23 Jun 2004 21:21:07 +0200 To: Sebastien Ferre Cc: caml-list@inria.fr Subject: Re: [Caml-list] file copy Message-ID: <20040623192107.GD2856@gallu.homelinux.org> Mail-Followup-To: Sebastien Ferre , caml-list@inria.fr References: <40D9A7E7.2060703@aber.ac.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <40D9A7E7.2060703@aber.ac.uk> User-Agent: Mutt/1.5.6+20040523i X-Miltered: at concorde with ID 40D9D827.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; le-gall:01 caml-list:01 2004:99 developping:01 'find':99 32,:01 cygwin:01 symlink:01 gall:01 le-gall:01 ocaml:01 command:98 command:98 unix:02 unix:02 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk 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. > Hello, 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 saturday. 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