过时
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.
这是
实验性技术
检查
浏览器兼容性表格
要小心谨慎在生产中使用这之前。
FileSystemDirectoryEntry
接口方法
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]);
successCallback
A function to call once the directory removal process has completed. The callback has no parameters.
errorCallback
可选
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_ERR
An attempt was made to remove the root directory; this is not permitted.
FileError.NO_MODIFICATION_ALLOWED_ERR
The file system's state doesn't permit modification.
FileError.NOT_FOUND_ERR
FileSystemDirectoryEntry
no longer exists.
FileError.NOT_READABLE_ERR
The directory is not accessible; perhaps it's in use by another application or is locked at the operating system level.
FileError.SECURITY_ERR
If 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 */
});
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
removeRecursively
弃用
非标
|
Chrome 8 | Edge 79 |
Firefox
50 — 52
|
IE No | Opera No | Safari No | WebView Android ≤37 | Chrome Android 18 |
Firefox Android
50 — 52
|
Opera Android No | Safari iOS No | Samsung Internet Android Yes |
完整支持
不支持
非标。预期跨浏览器支持较差。
弃用。不要用于新网站。
见实现注意事项。
FileSystemDirectoryEntry
createReader()
getDirectory()
getFile()
removeRecursively()
FileError
FileException
FileHandle
FileRequest
FileSystem
FileSystemDirectoryEntrySync
FileSystemDirectoryReader
FileSystemDirectoryReaderSync
FileSystemEntry
FileSystemEntrySync
FileSystemFileEntry
FileSystemFileEntrySync
FileSystemFlags
FileSystemSync
HTMLInputElement
LocalFileSystem
LocalFileSystemSync
LockedFile
元数据
Window.requestFileSystem()
Window.resolveLocalFileSystemURL()
WorkerGlobalScope.requestFileSystemSync()