Command/UpdateCorrectAddressDataCommand.php
protected function cleanDir($dirName)
    {
        if (file_exists($dirName)) {
            if (is_dir($dirName)) {
                $rm_path = new \RecursiveDirectoryIterator($dirName, \RecursiveDirectoryIterator::SKIP_DOTS);
                $rm_ls   = new \RecursiveIteratorIterator($rm_path, \RecursiveIteratorIterator::CHILD_FIRST);

                foreach ($rm_ls as $rm_file) {
                    $rm_file->isDir() ? rmdir($rm_file->getRealPath()) : unlink($rm_file->getRealPath());
                }
                rmdir($dirName);
            } else {
                unlink($dirName);
            }
        } else {
            mkdir($dirName, 0755, true);
            rmdir($dirName);
        }

        return true;
    }
protected function cleanDir($dirName)
    {
        if (file_exists($dirName)) {
            if (is_dir($dirName)) {
                $rm_path = new \RecursiveDirectoryIterator($dirName, \RecursiveDirectoryIterator::SKIP_DOTS);
                $rm_ls   = new \RecursiveIteratorIterator($rm_path, \RecursiveIteratorIterator::CHILD_FIRST);

                foreach ($rm_ls as $rm_file) {
                    $rm_file->isDir() ? rmdir($rm_file->getRealPath()) : unlink($rm_file->getRealPath());
                }
                rmdir($dirName);
            } else {
                unlink($dirName);
            }
        } else {
            mkdir($dirName, 0755, true);
            rmdir($dirName);
        }

        return true;
    }
@param string $dirName

@return bool