Directory:copy(dirname) method

Copies the Directory physically on the disk to the specified new directory name.

Warning

  • This operation will block program flow execution.
  • Use Directory.copytask() to copy directory asynchronously.

Parameters

dirname

A string representing the destination directory.
If the dirname contains a path, the path must already exist.

Return value

Returns a boolean value indicating if the operation succeeded.

Example

local dir = sys.Directory(C:\\test") -- copies the folder to another drive print(dir:copy("D:\\test"))