You are here

public function FileOperations::fileCopyRename in AT Tools 8

Same name and namespace in other branches
  1. 8.3 at_theme_generator/src/File/FileOperations.php \Drupal\at_theme_generator\File\FileOperations::fileCopyRename()
  2. 8.2 at_theme_generator/src/File/FileOperations.php \Drupal\at_theme_generator\File\FileOperations::fileCopyRename()

Copy and rename a file.

Parameters

array $file_paths: Associative array:

  • copy_source => "path to the source file"
  • copy_dest => "the destination path"
  • rename_oldname => "the old file name"
  • rename_newname => "the new file name"

File

at_theme_generator/src/File/FileOperations.php, line 56
Contains \Drupal\at_theme_generator\File\FileOperations

Class

FileOperations

Namespace

Drupal\at_theme_generator\File

Code

public function fileCopyRename($file_paths) {
  if (file_exists($file_paths['copy_source'])) {
    copy($file_paths['copy_source'], $file_paths['copy_dest']);
  }
  if (file_exists($file_paths['rename_oldname'])) {
    rename($file_paths['rename_oldname'], $file_paths['rename_newname']);
  }
}