这有效:
1> file:copy(test.html, test1.html).
{ok,2384}
但这不会:
2> file:copy(test.html, sites/test.html).
** exception error: bad argument in an arithmetic expression
in operator '/'/2
called as sites / 'test.html'
如何在 Erlang 中跨目录复制文件?
非常感谢,
本地资源计划
最佳答案
问题是sites/test.html
有特殊字符并且必须在单引号内。尝试:
file:copy(test.html, 'sites/test.html').
或者你可以使用字符串:
file:copy("test.html", "sites/test.html").
关于file - 如何在 Erlang 中跨目录复制文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11767392/