此方法用于复制现有文件。
语法
copy(source,destination)
参数
Source −需要复制的源文件名。
Destination −文件的目标路径和名称。
返回值
None
-module(helloworld). -export([start/0]). start() -> file:copy("Newfile.txt","Duplicate.txt").
一个名为Duplicate.txt的文件将被创建在与Newfile.txt相同的位置,它将具有与Newfile.txt相同的内容。