Skip to content

FileManager.trashFile method

FileManager › trashFile

Official

Remove a file or a folder from the vault according the user's preferred 'trash' options (either moving the file to .trash/ or the OS trash bin).

Signature:

trashFile(file: TAbstractFile): Promise<void>

Parameters:

ParameterTypeDescription
fileTAbstractFilethe file or folder.

Returns: Promise<void>

Since: 1.6.6

Example:

const file = vault.getFileByPath('foo/bar.md');
await fileManager.trashFile(file);