files/en-us/web/api/filesystemdirectoryhandle/removeentry/index.md
{{securecontext_header}}{{APIRef("File System API")}}{{AvailableInWorkers}}
The removeEntry() method of the
{{domxref("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)
name
options {{optional_inline}}
recursive {{optional_inline}}
false. When set to true entries will be removed recursively.A {{jsxref('Promise')}} which resolves with undefined.
NotAllowedError {{domxref("DOMException")}}
'granted' in readwrite mode.InvalidModificationError {{domxref("DOMException")}}
recursive is set to false and the entry to be removed has children.NotFoundError {{domxref("DOMException")}}
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
});
{{Specifications}}
{{Compat}}