Folder

interface OCP\Files\Folder
Implemented by:OC\Files\Node\LazyFolder OC\Files\Node\Folder
Source:lib/public/Files/Folder.php#42
Parent:OCP\Files\Node

Methods

public OCP\Files\Folder::getFullPath($path)
Get the full path of an item in the folder within owncloud’s filesystem
Source:

lib/public/Files/Folder.php#51

Parameters:
  • $path (string) relative path of an item in the folder
Returns:

string

Throws:

\OCP\Files\NotPermittedException

Since:

6.0.0

public OCP\Files\Folder::getRelativePath($path)
Get the path of an item in the folder relative to the folder
Source:

lib/public/Files/Folder.php#61

Parameters:
  • $path (string) absolute path of an item in the folder
Throws:

\OCP\Files\NotFoundException

Returns:

string | null

Since:

6.0.0

public OCP\Files\Folder::isSubNode($node)
check if a node is a (grand-)child of the folder
Source:

lib/public/Files/Folder.php#70

Parameters:
Returns:

bool

Since:

6.0.0

public OCP\Files\Folder::getDirectoryListing()
get the content of this directory
Source:lib/public/Files/Folder.php#79
Throws:\OCP\Files\NotFoundException
Returns:\OCP\Files\Node[]
Since:6.0.0
public OCP\Files\Folder::get($path)
Get the node at $path
Source:

lib/public/Files/Folder.php#89

Parameters:
  • $path (string) relative path of the file or folder
Returns:

\OCP\Files\Node

Throws:

\OCP\Files\NotFoundException

Since:

6.0.0

public OCP\Files\Folder::nodeExists($path)
Check if a file or folder exists in the folder
Source:

lib/public/Files/Folder.php#98

Parameters:
  • $path (string) relative path of the file or folder
Returns:

bool

Since:

6.0.0

public OCP\Files\Folder::newFolder($path)
Create a new folder
Source:

lib/public/Files/Folder.php#108

Parameters:
  • $path (string) relative path of the new folder
Returns:

\OCP\Files\Folder

Throws:

\OCP\Files\NotPermittedException

Since:

6.0.0

public OCP\Files\Folder::newFile($path, $content=null)
Create a new file
Source:

lib/public/Files/Folder.php#119

Parameters:
  • $path (string) relative path of the new file
  • $content (string | resource | null) content for the new file, since 19.0.0
Returns:

\OCP\Files\File

Throws:

\OCP\Files\NotPermittedException

Since:

6.0.0

public OCP\Files\Folder::search($query)
search for files with the name matching $query
Source:

lib/public/Files/Folder.php#128

Parameters:
Returns:

\OCP\Files\Node[]

Since:

6.0.0

public OCP\Files\Folder::searchByMime($mimetype)
search for files by mimetype
$mimetype can either be a full mimetype (image/png) or a wildcard mimetype (image)
Source:

lib/public/Files/Folder.php#138

Parameters:
  • $mimetype (string)
Returns:

\OCP\Files\Node[]

Since:

6.0.0

public OCP\Files\Folder::searchByTag($tag, $userId)
search for files by tag
Source:

lib/public/Files/Folder.php#148

Parameters:
  • $tag (string | int) tag name or tag id
  • $userId (string) owner of the tags
Returns:

\OCP\Files\Node[]

Since:

8.0.0

public OCP\Files\Folder::getById($id)
get a file or folder inside the folder by it’s internal id
This method could return multiple entries. For example once the file/folder
is shared or mounted (files_external) to the user multiple times.
Source:

lib/public/Files/Folder.php#160

Parameters:
  • $id (int)
Returns:

\OCP\Files\Node[]

Since:

6.0.0

public OCP\Files\Folder::getFreeSpace()
Get the amount of free space inside the folder
Source:lib/public/Files/Folder.php#168
Returns:int
Since:6.0.0
public OCP\Files\Folder::isCreatable()
Check if new files or folders can be created within the folder
Source:lib/public/Files/Folder.php#176
Returns:bool
Since:6.0.0
public OCP\Files\Folder::getNonExistingName($name)
Add a suffix to the name in case the file exists
Source:

lib/public/Files/Folder.php#186

Parameters:
  • $name (string)
Returns:

string

Throws:

\OCP\Files\NotPermittedException

Since:

8.1.0

public OCP\Files\Folder::getRecent($limit, $offset=0)
Source:

lib/public/Files/Folder.php#194

Parameters:
  • $limit (int)
  • $offset (int)
Returns:

\OCP\Files\Node[]

Since:

9.1.0