fs.move

Moves the file at the path path to the path dest. This is effectively equivalent to renaming the file.

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

Returns nil
API fs
Source CC:Tweaked (source)

The function will create any directories necessary, meaning you can move a file to /foo/bar/ and it will create the directory /foo if it does not already exist.

If path dest already exists, the function will error. This means you cannot move a directory into another directory, instead you will have to manually move all the files inside of it.

ExampleMove a directory
Creates the directory /foo and moves it to /bar
Code
<nowiki>
fs.makeDir("/foo")
fs.move("/foo", "/bar")
    </nowiki>
This article is issued from Computercraft. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.