fs.copy

From ComputerCraft
Jump to: navigation, search

fs.copy
Function
Syntax
fs.copy()
Returns nil
API fs
Source CC:Tweaked (source)

Copies the file at the path path to the path dest. If dest is a directory, the function will copy the file into that directory with its original name.

ExampleExampleCopy a file to a directory
Copies the edit program (/rom/programs/edit.lua) to the root directory (/).
Code
fs.copy("/rom/programs/edit.lua", "/")
Output A copy of the edit program will now be located at /edit.lua.
ExampleExampleCopy a file with a new name
Copies the clear program (/rom/programs/clear.lua) to /cls.lua.
Code
fs.copy("/rom/programs/clear.lua", "/cls.lua")
Output A copy of the clear program will now be located at /cls.lua