Luart
Comprehensive Windows framework to develop in Lua
modules > sys > File > copy

File : copy (filename) method

Copies the file physically on the disk to the specified filename.

Parameters

filename

A string representing the destination filename.

Return value

Returns true if the operation succeeded or false otherwise.

Example


local file = sys.File("test.txt"):open("write")
file:writeln("Hello World !")
file:close()

-- outputs false : cannot copy "test.txt" to "test.txt"
print(file:copy("test.txt"))