# FileSystemManager.rmdir(Object object)

with Promise style call: Not supported

Mini Program plugin: Support, need to Mini Program base library version no less than 2.19.2

Delete directory

# parameter

# Object object

attribute type Default values Required Introductions Minimum version
dirPath string yes Directory path to delete (Local path)
recursive boolean false no Whether to recursively delete the directory. If for True, the directory and all subdirectories and files under it are deleted. 2.3.0
success function no Interface calls the successful callback function
fail function no Interface calls failed callback functions
complete function no Callback function at the end of an interface call (both successful and unsuccessful calls are executed)

# object.fail callback

# parameter
# Object res
attribute type Introductions
errMsg string Error message

res.errMsg Legal value

value Introductions Minimum version
fail No such file or directory ${dirPath} Directory does not exist
fail directory not empty Directory is not empty
fail permission denied, open ${dirPath} Specified dirPath Path does not have write permissions
fail sdcard not mounted Android sdcard Mount failure

# sample code

const fs = wx.getFileSystemManager()
fs.rmdir({
  dirPath: `${wx.env.USER_DATA_PATH}/example`,
  recursive: false,
  success(res) {
    console.log(res)
  },
  fail(res) {
    console.error(res)
  }
})

// Synchronous interface
try {
  const res = fs.rmdirSync(`${wx.env.USER_DATA_PATH}/example`, false)
  console.log(res)
} catch(e) {
  console.error(e)
}