You are here

function _ctools_drush_file_delete in Chaos Tool Suite (ctools) 7

Delete files in a directory, keeping the .module and .info files.

Parameters

$path: Path to directory in which to remove files.

1 call to _ctools_drush_file_delete()
ctools_drush_export in drush/ctools.drush.inc
Drush callback: export.

File

drush/ctools.drush.inc, line 354
CTools Drush commands.

Code

function _ctools_drush_file_delete($path) {
  if (is_dir($path)) {
    $files = new DirectoryIterator($path);
    foreach ($files as $fileInfo) {
      if (!$fileInfo
        ->isDot() && !in_array($fileInfo
        ->getExtension(), array(
        'module',
        'info',
      ))) {
        unlink($fileInfo
          ->getPathname());
      }
    }
  }
}