# FileSystemManager.rmdirSync(string dirPath, boolean recursive)

with Promise style call: Not supported

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

FileSystemManager.rmdir The synchronous version of

# parameter

# string dirPath

Directory path to delete (Local path)

# boolean recursive

Start from base library version 2.3.0. Please remaining backward compatible.

Whether to recursively delete the directory. If for True, the directory and all subdirectories and files under it are deleted.

# error

Error code Error message Introductions
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)
}