Remove a file or array of files and folders from the zip archive

@param $fileToRemove array|string The path/array to the files in the zip

@return $this Zipper instance
341769
public function remove($fileToRemove)
    {
        if (is_array($fileToRemove)) {
            $self = $this;
            $this->repository->each(function ($file) use ($fileToRemove, $self) {
                if (starts_with($file, $fileToRemove)) {
                    $self->getRepository()->removeFile($file);
                }
            });
        } else {
            $this->repository->removeFile($fileToRemove);
        }

        return $this;
    }
1133355
public function clearCache()
    {
        $objects = scandir($this->getCachePath());
        $dir = $this->getCachePath();
        foreach ($objects as $object) {
            if ($object != "." && $object != "..") {
                if (is_dir($dir.$object)) {
                    self::rrmdir($dir.$object);
                } elseif ($object !== 'cache_config') {
                    unlink($dir.$object);
                }
            }
        }

        return $this;
    }
476226
public function clear()
    {
        $key = $this->key();
        $files = glob($this->path . "/_cache-" . $key . "*.cache");
        $this->setKey();
        $this->key(true);
        foreach ($files as $file) {
            unlink($file);
        }
        return $this;
    }
874753
protected function deletePackageArchive()
    {
        $packageArchive = $this->getPackagePath(true);
        $res = $this->getFileManager()->removeFile($packageArchive);

        return $res;
    }
500543
public function delete() {

		$this->purge();

		if(!@rmdir($this->path)) {
			throw new FilesystemFolderException(sprintf('Filesystem folder %s could not be deleted!', $this->path));
		}

		self::unsetInstance($this->path);

	}
362379
protected function cleanup(array $files = array())
    {
        if (empty($files)) {
            return $this;
        }
        foreach ($files as $file) {
            if (!file_exists($file->name)) {
                continue;
            }
            unlink($file->name);
        }
        return $this;
    }
1016717
public function unregisterFiles(PortableElementObject $object, $files)
    {
        $deleted = true;
        $filesystem = $this->getFileStorage();
        foreach ($files as $relPath) {
            $fileId = $this->getPrefix($object) . $relPath;
            if (!$filesystem->has($fileId)) {
                throw new \common_Exception('File does not exists in the filesystem: ' . $relPath);
            }
            $deleted = $filesystem->delete($fileId);
        }
        return $deleted;
    }
22353
public function delete($model, $log, $fileAttrName = 'files', $fileLogId = 0)
    {
        $updatedFiles = [];
        if ($log)
            $fileLogId = $log->id;

        $fileToDelete = [];
        foreach ($model->files as $file) {
            if ($file['file_log_id'] == $fileLogId)
                $fileToDelete = $file;
            else
                $updatedFiles[] = $file;
        }

        if ($log)
            Storage::delete($log->file_path);
        else
            Storage::delete($fileToDelete['path']);

        if ($log)
            $log->delete();

        $model->$fileAttrName = $updatedFiles;
        return $model;
    }
469275
protected function deleteFromFileStore(ParsedFileID $parsedFileID, Filesystem $fs, FileResolutionStrategy $strategy)
    {
        $deleted = false;
        /** @var ParsedFileID $parsedFileIDToDel */
        foreach ($strategy->findVariants($parsedFileID, $fs) as $parsedFileIDToDel) {
            $fs->delete($parsedFileIDToDel->getFileID());
            $deleted = true;
        }

        // Truncate empty dirs
        $this->truncateDirectory(dirname($parsedFileID->getFileID()), $fs);

        return $deleted;
    }
1199044
public function deleteDirectory($path)
    {
        if (false === $this->exists($path)) {
            return $this;
        }

        $this->getFilesystem()->remove($path);

        return $this;
    }
995813
protected function _removeKey($key)
    {
        $keys = $this->get('__stored_keys__', []);
        if (in_array($key, $keys)) {
            $reverse = array_flip($keys);
            unset($reverse[$key]);
            $this->set('__stored_keys__', array_keys($reverse));
        }
        return $this;
    }
1020113
public function delete($removeNode = true)
    {
        // first, we remove all files from the drive
        $db = Core::make(Connection::class);
        $em = $db->getEntityManager();
        $em->beginTransaction();
        try {
            // fire an on_page_delete event
            $fve = new \Concrete\Core\File\Event\DeleteFile($this);
            $fve = Events::dispatch('on_file_delete', $fve);
            if (!$fve->proceed()) {
                return false;
            }

            // Delete the tree node for the file.
            if ($removeNode) {
                $nodeID = $db->fetchColumn('select treeNodeID from TreeFileNodes where fID = ?', [$this->getFileID()]);
                if ($nodeID) {
                    $node = Node::getByID($nodeID);
                    $node->delete();
                }
            }

            $versions = $this->getVersionList();
            foreach ($versions as $fv) {
                $fv->delete(true);
            }

            $db->Execute('delete from FileSetFiles where fID = ?', [$this->fID]);
            $db->Execute('delete from FileSearchIndexAttributes where fID = ?', [$this->fID]);
            $db->Execute('delete from DownloadStatistics where fID = ?', [$this->fID]);
            $db->Execute('delete from FilePermissionAssignments where fID = ?', [$this->fID]);
            $db->Execute('delete from FileImageThumbnailPaths where fileID = ?', [$this->fID]);
            $db->Execute('delete from Files where fID = ?', [$this->fID]);

            $em->commit();
        } catch (\Exception $e) {
            $em->rollback();
            throw $e;
        }

        return true;
    }
205537
public function recursiveRemoveDirectory($path)
    {
        $files = new RecursiveIteratorIterator(
            new RecursiveDirectoryIterator($path, RecursiveDirectoryIterator::SKIP_DOTS),
            RecursiveIteratorIterator::CHILD_FIRST
        );
        foreach ($files as $file) {
            if ($file->isDir()) {
                self::removeDirectory($file->getRealPath());
            } else {
                self::unlink($file->getRealPath());
            }
        }
        self::removeDirectory($path);
    }
1108886
public function rm($filename)
    {
        $result = $this->client
            ->deleteObject(array(
                'Bucket' => $this->name,
                'Key'    => $filename
            ));

        return $result;
    }
129056
public function remove()
    {
        if ($this->isRegistered()) {
            $this->unRegister();
        }

        $path = getLocalPath('modules/' . $this->getName());

        if ($path) {
            (new Filesystem())->remove($_SERVER['DOCUMENT_ROOT'] . $path);
        }

        unset($this->object);

        return $this;
    }
641338
public function deleteStorgaFile()
    {
        if (!$this->onDeleteCascade) {
            return $this;
        }


        if ($this->relations) {
            foreach ($this->relations as $data) {
                $fieldName = ArrayHelper::getValue($data, 'property');

                if ($fileIds = $this->owner->{$fieldName}) {
                    if ($storageFiles = CmsStorageFile::find()->where(['id' => $fileIds])->all()) {
                        foreach ($storageFiles as $file) {
                            $file->delete();
                        }

                    }
                }
            }
        }

        if ($this->fields) {
            foreach ($this->fields as $fieldName) {

                if ($fileIds = $this->owner->{$fieldName}) {
                    if ($storageFiles = CmsStorageFile::find()->where(['id' => $fileIds])->all()) {
                        foreach ($storageFiles as $file) {
                            $file->delete();
                        }
                    }
                }
            }
        }

    }
1130427
public function deleteFile($path)
    {
        if (false === $this->exists($path)) {
            return $this;
        }

        $this->getFilesystem()->remove($path);

        return $this;
    }