Skip to content

TFolder

Official

A folder.

Import:

import { TFolder } from 'obsidian';

Signature:

export class TFolder extends TAbstractFile

Extends: TAbstractFile

Constructor

new TFolder(vault: Vault, path: string)

Constructor.

To get the constructor instance, use getTFolderConstructor from obsidian-typings/implementations.

Properties

Property Type Description
children TAbstractFile[] The children of the folder.
deleted boolean Whether the file or folder is being deleted.
(Inherited from TAbstractFile)
name string The name of the file.
(Inherited from TAbstractFile)
parent null | TFolder The parent folder of the file.
(Inherited from TAbstractFile)
path string The path of the file.
(Inherited from TAbstractFile)
vault Vault The vault.
(Inherited from TAbstractFile)

Methods

Method Returns Description
getFileCount() number Gets the count of files in the folder.
getFolderCount() number Gets the count of subfolders in the folder.
getNewPathAfterRename(newName) string Gets the path after renaming the file or folder.
(Inherited from TAbstractFile)
getParentPrefix() string Returns the prefix of the folder path.

If the folder is in the root '/', it returns an empty string. If the folder is 'a/b/c', it returns 'a/b/'.
isRoot() boolean Check if the folder is the root folder.
setPath(path) void Sets the path of the file or folder.
(Inherited from TAbstractFile)

Links to this page: