Skip to content

moveFile

Requires a Node.js runtime ('qsu/node')

Moves a file in the specified file path to another path. A directory is moved the same way, with everything inside it.

A rename cannot cross a filesystem boundary, and moving out of the temporary directory, into a mounted volume or onto another drive is exactly that. When the operating system reports it, the entry is copied to the target and the source removed, so the move still completes.

A path that is empty or nothing but whitespace does nothing.

Parameters

NameTypeRequiredDefault
filePathstringStringstr
File or directory path
targetFilePathstringStringstr
Path of file to move

Returns

Promise<void>

Future<void>

None

Examples

javascript
await moveFile('/home/user/text.txt', '/home/user/text2.txt');
dart
await moveFile('/home/user/text.txt', '/home/user/text2.txt');
python
moveFile('/home/user/text.txt', '/home/user/text2.txt')

Released under the MIT License