File.prototype.move()

Move a file to a different path.

Syntax

file.move(placement uint32, target File, name string, placeholder uint8) File

Warning: move returns another file. This is crucial as moving files across filesystems (think of the //temp filesystem) currently breaks the file reference.

Parameters

placement uint32

Where to place the file relative the the target. One of [os.BEFORE, os.AFTER, os.PREPEND, os.APPEND]. See file placement for more details. [TODO: add link]

target File

Place the file relative to this one.

name string

File’s name. It is invalid to use special characters like spaces. Providing an empty string defaults to using the name of the source file.

placeholder uint8

Which placeholder to place the file in. Note: this argument is only required when os.APPEND or os.PREPEND placement flags were used.

Description

Move a file with its entire subtree to a different path by placing it in the filesystem relative to the target file.

Examples

Basic example, move a file in another

Rename a file.

Placement os.PREPEND.

Placement os.APPEND.

Placement os.BEFORE.

Placement os.AFTER.

All arguments must be provided

It is invalid to use spaces or special chars in the name.

File reference (variable) breaks when moving across filesystem boundaries. Make sure to use the returned value of move.