You are here

public function FileOperations::fileDeleteByExtension in AT Tools 8.3

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

Unlink all files by extension in a directory.

Parameters

string $ext:

string $file_path:

File

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

Class

FileOperations

Namespace

Drupal\at_theme_generator\File

Code

public function fileDeleteByExtension($file_path, $ext) {
  $glob_files = glob("{$file_path}/*.{$ext}");
  foreach ($glob_files as $file) {
    \Drupal::service('file_system')
      ->unlink($file);
  }
}