File helper


1Overview

Helper offering file processing functionalities.


2recursiveCopy()

This static method recursively copies the contents of a directory or file.

Method signature:

recursiveCopy(string $from, string $to, bool $force=false,
              bool $sync=false, bool $hidden=false) : void

Parameters :

  • $from : Path to source.
  • $to : Path to destination.
  • $force : (optional) true to delete files/links/folders that exist with the same name as an item to be copied but a different type.
  • $sync : (optional) true to delete items from the destination that do not exist in the source.
  • $hidden : (optional) true true to copy files and directories whose name begins with a dot.

3recursiveRemove()

This static method deletes a directory and its contents.

Method signature:

recursiveRemove(string $path) : void

Parameter :

  • $path : Path to the directory to be deleted.