Since March 2023, this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.
Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.
Note: This feature is available in Web Workers.
The removeEntry() method of the FileSystemDirectoryHandle interface attempts to remove an entry if the directory handle contains a file or directory called the name specified.
removeEntry(name) removeEntry(name, options)
nameA string representing the FileSystemHandle.name of the entry you wish to remove.
options OptionalAn optional object containing options, which are as follows:
recursive OptionalA boolean value, which defaults to false. When set to true entries will be removed recursively.
A Promise which resolves with undefined.
TypeErrorThrown if the name is not a valid string or contains characters not allowed on the file system.
NotAllowedError DOMException
Thrown if the PermissionStatus.state for the handle is not 'granted' in readwrite mode.
InvalidModificationError DOMException
Thrown if recursive is set to false and the entry to be removed has children.
NotFoundError DOMException
Thrown if the current entry is not found or if the entry of the specific name is not found or matched.
The following example removes an entry within the directory handle.
const entryName = "entryToRemove";
// assuming we have a directory handle: 'currentDirHandle'
currentDirHandle.removeEntry(entryName).then(() => {
// code to run if removing was successful
});
| Specification |
|---|
| File System> # api-filesystemdirectoryhandle-removeentry> |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
removeEntry |
86 | 86 | 111 | 72 | 15.2 | 109 | 111 | 74 | 15.2 | 21.0 | 109 | 15.2 |
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/FileSystemDirectoryHandle/removeEntry