src/Listeners/ClearDirectoriesListener.php
/**
     * Delete's all files from the passed directory and deletes the directory
     * as well if it contains no more files.
     *
     * @param string $directory The directory that has to be cleared
     * @param string $serial    The serial of the actual import process
     *
     * @return void
     */
Delete's all files from the passed directory and deletes the directory
as well if it contains no more files.

@param string $directory The directory that has to be cleared
@param string $serial    The serial of the actual import process

@return void
Delete ' s all files from the passed directory and deletes the directory as well if it contains no more files . @param string $directory The directory that has to be cleared @param string $serial The serial of the actual import process @return void
protected function clearDirectory($directory, $serial)
    {
        $filesystemAdapter = $this->getFilesystemAdapter();
        if ($filesystemAdapter->isDir($directory) && sizeof($filesystemAdapter->listContents($directory, true)) === 0) {
            if (preg_match(sprintf('/.*\/%s$/', $serial), $directory) === 1) {
                $filesystemAdapter->removeDir($directory);
            }
        }
    }
protected function clearDirectory ( $ directory , $ serial ) { $ filesystemAdapter = $ this -> getFilesystemAdapter ( ) ; if ( $ filesystemAdapter -> isDir ( $ directory ) && sizeof ( $ filesystemAdapter -> listContents ( $ directory , true ) ) === 0 ) { if ( preg_match ( sprintf ( '/.*\/%s$/' , $ serial ) , $ directory ) === 1 ) { $ filesystemAdapter -> removeDir ( $ directory ) ; } } }
Delete's all files from the passed directory and deletes the directory
 as well if it contains no more files.
Delete ' s all files from the passed directory and deletes the directory as well if it contains no more files .
// load the filesystem adapter and init // file iterator on source directory // query whether or not we've a directory and it IS empty // remove the directory ONLY it has been created during the import process