Skip to content

FileManager.trashFile method

FileManager › trashFile

Removes a file or folder according to the user's trash preference (the vault's .trash folder or the system trash).

Routes on the vault's trashOption setting exactly as Obsidian does: system (the default) trashes through vault.trash(file, true), local through vault.trash(file, false), and none deletes permanently through vault.delete(file, true). Any other value does **nothing at all** — Obsidian's three branches have no else, so a key set to an unrecognized value leaves the file where it is.

Signature:

trashFile(file: TAbstractFile): Promise<void>

Parameters:

ParameterTypeDescription
fileTAbstractFileThe file or folder to remove.

Returns: Promise<void>