Erlang - copy


Advertisements

This method is used to make a copy of an existing file.

Syntax

copy(source,destination)

Parameters

  • Source − The name of the source file which needs to be copied.

  • Destination − The destination path and name of the file.

Return Value

None

For example

-module(helloworld).
-export([start/0]). 

start() ->   
   file:copy("Newfile.txt","Duplicate.txt").

Output

A file called Duplicate.txt will be created in the same location as the Newfile.txt and it will have the same contents as Newfile.txt.

erlang_file_input_output.htm
Advertisements