Erlang - copy 方法

此方法用于复制现有文件。

语法

copy(source,destination)

参数

  • Source − 需要复制的源文件的名称。

  • destination − 文件的目标路径和名称。

返回值

None

例如

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

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

输出

名为 Duplicate.txt 的文件将在与 Newfile.txt 相同的位置创建,并且其内容与 Newfile.txt 相同。

❮ erlang_file_input_output.html