Files

class OCP\Files
This class provides access to the internal filesystem abstraction layer. Use
this class exlusively if you want to access files
Source:lib/public/Files.php#51

Methods

public static OCP\Files::rmdirr($dir)
Recusive deletion of folders
Source:lib/public/Files.php#58
Returns:bool
Since:5.0.0
Deprecated:14.0.0
public static OCP\Files::getMimeType($path)
Get the mimetype form a local file
Source:

lib/public/Files.php#70

Parameters:
  • $path (string)
Returns:

string does NOT work for ownClouds filesystem, use OC_FileSystem::getMimeType instead

Since:

5.0.0

Deprecated:

14.0.0

public static OCP\Files::searchByMime($mimetype)
Search for files by mimetype
Source:

lib/public/Files.php#81

Parameters:
  • $mimetype (string)
Returns:

array

Since:

6.0.0

Deprecated:

14.0.0

public static OCP\Files::streamCopy($source, $target)
Copy the contents of one stream to another
Source:

lib/public/Files.php#93

Parameters:
  • $source (resource)
  • $target (resource)
Returns:

int the number of bytes copied

Since:

5.0.0

Deprecated:

14.0.0

public static OCP\Files::buildNotExistingFileName($path, $filename)
Adds a suffix to the name in case the file exists
Source:

lib/public/Files.php#106

Parameters:
  • $path (string)
  • $filename (string)
Returns:

string

Since:

5.0.0

Deprecated:

14.0.0 use getNonExistingName of the OCP\Files\Folder object

public static OCP\Files::getStorage($app)
Gets the Storage for an app - creates the needed folder if they are not
existent
Source:

lib/public/Files.php#118

Parameters:
  • $app (string)
Returns:

\OC\Files\View

Since:

5.0.0

Deprecated:

14.0.0 use IAppData instead