Difference between revisions of "Fs.copy"

From ComputerCraft Wiki
Jump to: navigation, search
m (Moved to CAT:LuaCoreFunctions)
(Copy description from API page and use type template)
 
Line 2: Line 2:
 
{{Function
 
{{Function
 
|name=fs.copy
 
|name=fs.copy
|args=[[string (type)|string]] fromPath, [[string (type)|string]] toPath
+
|args={{Type|string}} fromPath, {{Type|string}} toPath
 
|api=fs
 
|api=fs
|desc=Copies a file or directory to a new location (the parent of the new location must be a directory, <var>toPath</var> must include the target filename and cannot be only a directory to move the file into, and <var>toPath</var> itself must not already exist)
+
|desc=Copies a file or directory to a new location. The parent of the new location must be an existing, writable directory, <var>toPath</var> must include the target filename and cannot be only a directory to move the file into, and <var>toPath</var> itself must not already exist.
 
|examples=
 
|examples=
 
{{Example
 
{{Example

Latest revision as of 19:43, 22 April 2013


Grid Redstone.png  Function fs.copy
Copies a file or directory to a new location. The parent of the new location must be an existing, writable directory, toPath must include the target filename and cannot be only a directory to move the file into, and toPath itself must not already exist.
Syntax fs.copy(string fromPath, string toPath)
Returns nil
Part of ComputerCraft
API fs

Examples

Grid paper.png  Example
Makes a copy of a file "test1" in the root directory, calling it "test2" and storing the copy in a directory called "mydir"
Code
fs.copy("test1", "mydir/test2")