file.removeDir() INVALID_MODIFICATION_ERR (code: 9)


I’m using cordova-plugin-file to try to remove a directory, but I’m getting “INVALID_MODIFICATION_ERR (code: 9)” error.
file.checkDir() says that file exists, but when I try to remove ir i got that error.

this.file.removeDir(this.file.dataDirectory, 'images')
			.then(entry =>{
					console.log('pasta images deletada');
					//return this.file.copyDir(this.file.applicationDirectory + 'www/', 'images', this.file.dataDirectory, 'images')
				.catch(err =>{

Am I forgetting something?
Thank you


I solved my problem. I can remove the directory using file.removeRecursively() method.


Thanks! Worked For me as well.