CakePHP
  • Documentation
    • Book
    • API
    • Videos
    • Reporting Security Issues
    • Privacy Policy
    • Logos & Trademarks
  • Business Solutions
  • Swag
  • Road Trip
  • Team
  • Community
    • Community
    • Get Involved
    • Issues (Github)
    • Bakery
    • Featured Resources
    • Training
    • Meetups
    • My CakePHP
    • CakeFest
    • Newsletter
    • Linkedin
    • YouTube
    • Facebook
    • Twitter
    • Mastodon
    • Help & Support
    • Forum
    • Stack Overflow
    • IRC
    • Slack
    • Paid Support
CakePHP

C CakePHP 4.6 Strawberry API

  • Project:
    • CakePHP
      • CakePHP
      • Authentication
      • Authorization
      • Chronos
      • Elastic Search
      • Queue
  • Version:
    • 4.6
      • 5.2
      • 5.1
      • 5.0
      • 4.6
      • 4.5
      • 4.4
      • 4.3
      • 4.2
      • 4.1
      • 4.0
      • 3.10
      • 3.9
      • 3.8
      • 3.7
      • 3.6
      • 3.5
      • 3.4
      • 3.3
      • 3.2
      • 3.1
      • 3.0
      • 2.10
      • 2.9
      • 2.8
      • 2.7
      • 2.6
      • 2.5
      • 2.4
      • 2.3
      • 2.2
      • 2.1
      • 2.0
      • 1.3
      • 1.2

Namespaces

  • Global
  • Cake
    • Auth
    • Cache
    • Collection
    • Command
    • Console
    • Controller
    • Core
    • Database
    • Datasource
    • Error
    • Event
    • Filesystem
    • Form
    • Http
    • I18n
    • Log
    • Mailer
    • Network
    • ORM
    • Routing
    • Shell
    • TestSuite
    • Utility
    • Validation
    • View

Class Filesystem

This provides convenience wrappers around common filesystem queries.

This is an internal helper class that should not be used in application code as it provides no guarantee for compatibility.

Namespace: Cake\Filesystem

Constants

  • string
    TYPE_DIR ¶
    'dir'

    Directory type constant

Method Summary

  • copyDir() public

    Copies directory with all it's contents.

  • deleteDir() public

    Delete directory along with all it's contents.

  • dumpFile() public

    Dump contents to file.

  • filterIterator() protected

    Wrap iterator in additional filtering iterator.

  • find() public

    Find files / directories (non-recursively) in given directory path.

  • findRecursive() public

    Find files/ directories recursively in given directory path.

  • isStream() public

    Check whether the given path is a stream path.

  • mkdir() public

    Create directory.

Method Detail

copyDir() ¶ public

copyDir(string $source, string $destination): bool

Copies directory with all it's contents.

Parameters
string $source

Source path.

string $destination

Destination path.

Returns
bool

deleteDir() ¶ public

deleteDir(string $path): bool

Delete directory along with all it's contents.

Parameters
string $path

Directory path.

Returns
bool
Throws
Cake\Core\Exception\CakeException
If path is not a directory.

dumpFile() ¶ public

dumpFile(string $filename, string $content): void

Dump contents to file.

Parameters
string $filename

File path.

string $content

Content to dump.

Returns
void
Throws
Cake\Core\Exception\CakeException
When dumping fails.

filterIterator() ¶ protected

filterIterator(Iterator $iterator, mixed $filter): Iterator

Wrap iterator in additional filtering iterator.

Parameters
Iterator $iterator

Iterator

mixed $filter

Regex string or callback.

Returns
Iterator

find() ¶ public

find(string $path, mixed $filter = null, int|null $flags = null): Iterator

Find files / directories (non-recursively) in given directory path.

Parameters
string $path

Directory path.

mixed $filter optional

If string will be used as regex for filtering using RegexIterator, if callable will be as callback for CallbackFilterIterator.

int|null $flags optional

Flags for FilesystemIterator::__construct();

Returns
Iterator

findRecursive() ¶ public

findRecursive(string $path, mixed $filter = null, int|null $flags = null): Iterator

Find files/ directories recursively in given directory path.

Parameters
string $path

Directory path.

mixed $filter optional

If string will be used as regex for filtering using RegexIterator, if callable will be as callback for CallbackFilterIterator. Hidden directories (starting with dot e.g. .git) are always skipped.

int|null $flags optional

Flags for FilesystemIterator::__construct();

Returns
Iterator

isStream() ¶ public

isStream(string $path): bool

Check whether the given path is a stream path.

Parameters
string $path

Path.

Returns
bool

mkdir() ¶ public

mkdir(string $dir, int $mode = 0755): void

Create directory.

Parameters
string $dir

Directory path.

int $mode optional

Octal mode passed to mkdir(). Defaults to 0755.

Returns
void
Throws
Cake\Core\Exception\CakeException
When directory creation fails.
OpenHub
Pingping
Linode
  • Business Solutions
  • Showcase
  • Documentation
  • Book
  • API
  • Videos
  • Reporting Security Issues
  • Privacy Policy
  • Logos & Trademarks
  • Community
  • Get Involved
  • Issues (Github)
  • Bakery
  • Featured Resources
  • Training
  • Meetups
  • My CakePHP
  • CakeFest
  • Newsletter
  • Linkedin
  • YouTube
  • Facebook
  • Twitter
  • Mastodon
  • Help & Support
  • Forum
  • Stack Overflow
  • IRC
  • Slack
  • Paid Support

Generated using CakePHP API Docs