caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Re: [Caml-list] file copy
  2004-06-23 15:55 [Caml-list] file copy Sebastien Ferre
@ 2004-06-23 15:06 ` Maxence Guesdon
  2004-06-23 15:20 ` skaller
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Maxence Guesdon @ 2004-06-23 15:06 UTC (permalink / raw)
  To: Sebastien Ferre; +Cc: caml-list

On Wed, 23 Jun 2004 15:55:19 +0000
Sebastien Ferre <sbf@aber.ac.uk> 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 find it in Didier Remy's course about system programming :
http://pauillac.inria.fr/~remy/poly/system/camlunix/fich.html#toc13

Hope this helps,

Maxence Guesdon

-------------------
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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Caml-list] file copy
  2004-06-23 15:55 [Caml-list] file copy Sebastien Ferre
  2004-06-23 15:06 ` Maxence Guesdon
@ 2004-06-23 15:20 ` skaller
  2004-06-23 16:37 ` padiolea
  2004-06-23 19:21 ` sylvain.le-gall
  3 siblings, 0 replies; 5+ messages in thread
From: skaller @ 2004-06-23 15:20 UTC (permalink / raw)
  To: Sebastien Ferre; +Cc: caml-list

On Thu, 2004-06-24 at 01:55, 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.

You may consider:

ocaml-fileutils.
----------------
 
This library is intended to provide a basic interface to the most
common file and filename operation. It provides different filename
function : reduce, make_absolute, make_relative... It also enables
to manipulate real file : cp, mv, rm, touch...
 
AUTHOR: Sylvain LE GALL
AVAILABLE:

http://www.carva.org/sylvain.le-gall/ocaml-fileutils.html


-- 
John Skaller, mailto:skaller@users.sf.net
voice: 061-2-9660-0850, 
snail: PO BOX 401 Glebe NSW 2037 Australia
Checkout the Felix programming language http://felix.sf.net



-------------------
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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Caml-list] file copy
@ 2004-06-23 15:55 Sebastien Ferre
  2004-06-23 15:06 ` Maxence Guesdon
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Sebastien Ferre @ 2004-06-23 15:55 UTC (permalink / raw)
  To: caml-list

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.

Cheers,
Sébastien

-------------------
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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Caml-list] file copy
  2004-06-23 15:55 [Caml-list] file copy Sebastien Ferre
  2004-06-23 15:06 ` Maxence Guesdon
  2004-06-23 15:20 ` skaller
@ 2004-06-23 16:37 ` padiolea
  2004-06-23 19:21 ` sylvain.le-gall
  3 siblings, 0 replies; 5+ messages in thread
From: padiolea @ 2004-06-23 16:37 UTC (permalink / raw)
  To: Sebastien Ferre; +Cc: caml-list

> 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.

In fact there is no copy operation in  a filesystem
(observe the output of the command 'strace cp /tmp/titi /tmp/titi').
You can emulate the copy by combining reading and writing,
as the cp do,
so in ocaml combining functions input and ouput.


> I could not find any neither in the standard library,
> nor in the Unix library.
>
> Cheers,
> Sébastien
>
> -------------------
> 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
>

-------------------
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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Caml-list] file copy
  2004-06-23 15:55 [Caml-list] file copy Sebastien Ferre
                   ` (2 preceding siblings ...)
  2004-06-23 16:37 ` padiolea
@ 2004-06-23 19:21 ` sylvain.le-gall
  3 siblings, 0 replies; 5+ messages in thread
From: sylvain.le-gall @ 2004-06-23 19:21 UTC (permalink / raw)
  To: Sebastien Ferre; +Cc: caml-list

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2004-06-23 19:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-06-23 15:55 [Caml-list] file copy Sebastien Ferre
2004-06-23 15:06 ` Maxence Guesdon
2004-06-23 15:20 ` skaller
2004-06-23 16:37 ` padiolea
2004-06-23 19:21 ` sylvain.le-gall

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).