You are here

public function FileOperations::fileCopyRename in AT Tool 2.0 1.0.x

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 55

Class

FileOperations

Namespace

Drupal\at_theme_generator\File

Code

public function fileCopyRename($file_paths) {
  if (file_exists($file_paths['copy_source'])) {

    /*file_unmanaged_copy($file_paths['copy_source'], $file_paths['copy_dest'], FILE_EXISTS_RENAME);*/
    \Drupal::service('file_system')
      ->copy($file_paths['copy_source'], $file_paths['copy_dest'], FileSystemInterface::EXISTS_RENAME);
  }
}