Back to Joomla project (class list)

Class Folder - list of methods

A Folder handling class
Package: Joomla\CMS\Filesystem
Copyright: (C) 2006 Open Source Matters, Inc.
License: GNU General Public License version 2 or later; see LICENSE.txt
Located at: Joomla/Filesystem/Folder.php
Project: Joomla

Method Summary

public static bool
(mixed $src, mixed $dest, mixed $path = '', mixed $force = false, mixed $useStreams = false)

Copy a folder.
Parameters
  • string $src The path to the source folder.
  • string $dest The path to the destination folder.
  • string $path An optional base path to prefix to the file names.
  • bool $force Force copy.
  • bool $useStreams Optionally force folder/file overwrites.
Returns
  • bool True on success.
Since
  • 1.7.0
-
  • \RuntimeException
Show source code of this method: copy Source Code

public static bool
(mixed $path = '', mixed $mode = 0755)

Create a folder -- and all necessary parent folders.
Parameters
  • string $path A path to create from the base path.
  • int $mode Directory permissions to set for folders created. 0755 by default.
Returns
  • bool True if successful.
Since
  • 1.7.0
Show source code of this method: create Source Code

public static bool
(mixed $path)

Delete a folder.
Parameters
  • string $path The path to the folder to delete.
Returns
  • bool True on success.
Since
  • 1.7.0
Show source code of this method: delete Source Code

public static mixed
(mixed $src, mixed $dest, mixed $path = '', mixed $useStreams = false)

Moves a folder.
Parameters
  • string $src The path to the source folder.
  • string $dest The path to the destination folder.
  • string $path An optional base path to prefix to the file names.
  • bool $useStreams Optionally use streams.
Returns
  • mixed Error message on false or boolean true on success.
Since
  • 1.7.0
Show source code of this method: move Source Code

public static bool
(mixed $path)

Wrapper for the standard file_exists function
Parameters
  • string $path Folder name relative to installation dir
Returns
  • bool True if path is a folder
Since
  • 1.7.0
Show source code of this method: exists Source Code

public static array|bool
(mixed $path, mixed $filter = '.', mixed $recurse = false, mixed $full = false, mixed $exclude = array('.svn', 'CVS', '.DS_Store', '__MACOSX'), mixed $excludeFilter = array('^\\..*', '.*~'), mixed $naturalSort = false)

Utility function to read the files in a folder.
Parameters
  • string $path The path of the folder to read.
  • string $filter A filter for file names.
  • mixed $recurse True to recursively search into sub-folders, or an integer to specify the maximum depth.
  • bool $full True to return the full path to the file.
  • array $exclude Array with names of files which should not be shown in the result.
  • array $excludeFilter Array of filter to exclude
  • bool $naturalSort False for asort, true for natsort
Returns
  • array|bool Files in the given folder.
Since
  • 1.7.0
Show source code of this method: files Source Code

public static array
(mixed $path, mixed $filter = '.', mixed $recurse = false, mixed $full = false, mixed $exclude = array('.svn', 'CVS', '.DS_Store', '__MACOSX'), mixed $excludeFilter = array('^\\..*'))

Utility function to read the folders in a folder.
Parameters
  • string $path The path of the folder to read.
  • string $filter A filter for folder names.
  • mixed $recurse True to recursively search into sub-folders, or an integer to specify the maximum depth.
  • bool $full True to return the full path to the folders.
  • array $exclude Array with names of folders which should not be shown in the result.
  • array $excludeFilter Array with regular expressions matching folders which should not be shown in the result.
Returns
  • array Folders in the given folder.
Since
  • 1.7.0
Show source code of this method: folders Source Code

protected static array
(mixed $path, mixed $filter, mixed $recurse, mixed $full, mixed $exclude, mixed $excludeFilterString, mixed $findFiles)

Function to read the files/folders in a folder.
Parameters
  • string $path The path of the folder to read.
  • string $filter A filter for file names.
  • mixed $recurse True to recursively search into sub-folders, or an integer to specify the maximum depth.
  • bool $full True to return the full path to the file.
  • array $exclude Array with names of files which should not be shown in the result.
  • string $excludeFilterString Regexp of files to exclude
  • bool $findFiles True to read the files, false to read the folders
Returns
  • array Files.
Since
  • 1.7.0
Show source code of this method: _items Source Code

public static array
(mixed $path, mixed $filter, mixed $maxLevel = 3, mixed $level = 0, mixed $parent = 0)

Lists folder in format suitable for tree display.
Parameters
  • string $path The path of the folder to read.
  • string $filter A filter for folder names.
  • int $maxLevel The maximum number of levels to recursively read, defaults to three.
  • int $level The current level, optional.
  • int $parent Unique identifier of the parent folder, if any.
Returns
  • array Folders in the given folder.
Since
  • 1.7.0
Show source code of this method: listFolderTree Source Code

public static string
(mixed $path)

Makes path name safe to use.
Parameters
  • string $path The full path to sanitise.
Returns
  • string The sanitised string.
Since
  • 1.7.0
Show source code of this method: makeSafe Source Code

Tags Summary

Since
1.7.0