Obsolete
This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it.
This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
The FileSystemDirectoryEntry interface's method removeRecursively() removes the directory as well as all of its content, hierarchically iterating over its entire subtree of descendant files and directories.
To remove a single file, or an empty directory, you can also use FileSystemEntry.remove().
FileSystemDirectoryEntry.removeRecursively(successCallback[, errorCallback]);
successCallbackerrorCallback Optional
FileError describing the error which occurred as input.If an error occurs and an errorCallback was specified, it gets called with a single parameter: a FileError object describing the error. The FileError.code specifies what type of error occurred, as follows:
FileError.INVALID_MODIFICATION_ERRFileError.NO_MODIFICATION_ALLOWED_ERRFileError.NOT_FOUND_ERRFileSystemDirectoryEntry no longer exists.FileError.NOT_READABLE_ERRFileError.SECURITY_ERRIf you try to delete a directory which contains one or more files that can't be removed, or if an error occurs while deletion of a number of files is underway, some files may not be deleted. You should provide an errorCallback to watch for and handle this, perhaps by trying again.
directory.removeRecursively(function() {
/* The directory was removed successfully */
}, function() {
/* an error occurred while removing the directory */
}); | Specification | Status | Comment |
|---|---|---|
| File and Directory Entries API The definition of 'getDirectory()' in that specification. | Draft | Now removed from spec! |
This API has no official W3C or WHATWG specification.
| Desktop | ||||||
|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | |
| Basic support | 13 | No | 50 — 52
|
No | No | No |
| Mobile | |||||||
|---|---|---|---|---|---|---|---|
| Android webview | Chrome for Android | Edge Mobile | Firefox for Android | Opera for Android | iOS Safari | Samsung Internet | |
| Basic support | Yes | Yes | ? | 50 — 52
|
No | No | ? |
FileSystemDirectoryEntryFileSystemEntry.remove()
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/FileSystemDirectoryEntry/removeRecursively