fs.copy

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.

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

fs.copy
Function
Syntax
fs.copy(
  • path : string
  • dest : string
)

Returns nil
API fs
Source CC:Tweaked (source)
This article is issued from Computercraft. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.