fs.move
fs.move
Function
Move the current file or directory to the target directory, keeping the file name unchanged.
Syntax
fs(path).move(dir)
Parameters
| Parameters | Type | Required | Default value | Description |
|---|---|---|---|---|
| dir | String | Yes | None | The target directory. |
Return value
| Type | Description |
|---|---|
| Fs | Returns the fs object bound to the moved path. |
Example
file = fs('docs-move.txt') file.write('BT') result = file.move('moved') // Output: Fs echo(type(result))
Notes
- The target directory will be automatically created if it does not exist.
- move uses the original file name as the target file name.