Skip to main content
Version: v1.0

hmFS.rename(oldPath, newPath)

For an introduction to the Zepp OS Mini Program file system, please refer to File System.

Rename the file in the /data data directory of the Mini Program.

Type

(oldPath: string, newPath: string) => result

Parameters

ParametersDescriptionRequiredTypeDefault
oldPathold file path (relative path)yesstring-
newPathnew file path (relative path)yesstring-

result

DescriptionType
The result of the operation, 0 means successnumber

Please refer to File System - Error Code for the rest of the error codes.

Code example

Page({
build() {
const result = hmFS.rename('path/to/old_file.txt', 'path/to/new_file.txt')
console.log(result)
}
})