Removes files or directories.

@param string|array|\Traversable $files A filename, an array of files, or a \Traversable instance to remove

@throws \RuntimeException When removal fails
355688
public function remove($files)
    {
        $files = iterator_to_array($this->toIterator($files));
        $files = array_reverse($files);
        foreach ($files as $file) {
            if (!file_exists($file) && !is_link($file)) {
                continue;
            }

            if (is_dir($file) && !is_link($file)) {
                $this->remove(new \FilesystemIterator($file));

                if (true !== @rmdir($file)) {
                    throw new \RuntimeException(sprintf('Failed to remove directory "%s".', $file), 0, null);
                }
            } else {
                // https://bugs.php.net/bug.php?id=52176
                if (defined('PHP_WINDOWS_VERSION_MAJOR') && is_dir($file)) {
                    if (true !== @rmdir($file)) {
                        throw new \RuntimeException(sprintf('Failed to remove file "%s".', $file), 0, null);
                    }
                } else {
                    if (true !== @unlink($file)) {
                        throw new \RuntimeException(sprintf('Failed to remove file "%s".', $file), 0, null);
                    }
                }
            }
        }
    }
685910
static function Delete($dir)
    {
        $files = self::GetFileSystemEntries($dir);
        
        foreach($files as $file)
        {
            $path = Path::Combine($dir, $file);
            switch(self::GetFileSystemEntryType($path))
            {
                case FileSystemEntryType::File():
                case FileSystemEntryType::Link():
                    unlink($path);
                    break;
                
                case FileSystemEntryType::Folder():
                    self::Delete($path);
                    break;
            }
        }
        rmdir($dir);
    }
689938
def delete_files(paths):
    
    for path in paths:
        if os.path.exists(path):
            os.remove(path)
464190
public static function removeDirectory($directory)
    {
        $inner = new \RecursiveDirectoryIterator($directory, \FilesystemIterator::SKIP_DOTS);
        $outer = new \RecursiveIteratorIterator($inner, \RecursiveIteratorIterator::SELF_FIRST);

        // remove the files first
        foreach ($outer as $file) {
            if ($file->isFile()) {
                unlink($file);
            }
        }

        // remove the sub-directories next
        $files = iterator_to_array($outer);
        foreach (array_reverse($files) as $file) {
            /** @var \SplFileInfo $file */
            if ($file->isDir()) {
                rmdir($file);
            }
        }

        // finally the directory itself
        rmdir($directory);
    }
146395
public function remove($path, $recursive = false)
    {
        $fileToRemove = $this->nodeAt($path);

        if (!$recursive && $fileToRemove instanceof Directory) {
            throw new \RuntimeException('Won\'t non-recursively remove directory');
        }

        $this->directoryAt(dirname($path))->remove(basename($path));

        clearstatcache(true, $path);
    }
339604
public function remove($path)
    {
        list($name, $path) = $this->splitPath($path);

        if (empty($path)) {
            throw new RuntimeException('The root node of config is not writable');
        }

        return $this->load($name)->remove($path);
    }
696145
protected function deleteFiles()
    {
        $this->storage->delete($this->path);

        if ($this->type == 'image') {
            $this->storage->delete($this->thumbnails->toArray());
        }
    }
780195
public function delete($file)
	{
		$metaFile = $this->getMetaFilePath($file);
		if ($this->fs->exists($metaFile))
			$this->fs->delete($metaFile);
		if ($this->f3->get('CACHE')) {
			$cache = \Cache::instance();
			if ($cache->exists($cacheHash = $this->getCacheHash($file)))
				$cache->clear($cacheHash);
		}
	}
1032
public static function deleteAllFilesInDirectory ($dir) {
        $dirIterator = new \RecursiveDirectoryIterator($dir, \FilesystemIterator::SKIP_DOTS);
        foreach (new \RecursiveIteratorIterator($dirIterator, \RecursiveIteratorIterator::CHILD_FIRST) as $file) {
            $file->isDir() ? rmdir($file) : unlink($file);
        }
    }
306256
public function setPaths($paths)
    {
        if (!is_array($paths) && !$paths instanceof Traversable) {
            throw new Exception\InvalidArgumentException(sprintf(
                'Invalid argument provided for $paths, expecting either an array or Traversable object, "%s" given',
                is_object($paths) ? get_class($paths) : gettype($paths)
            ));
        }

        $this->clearPaths();
        $this->addPaths($paths);
    }
1255815
public function setFiles($files = [])
    {
        if (!$files instanceof FileBag) {
            $files = new FileBag($files);
        }

        $this->_files = $files;
    }
129413
public function deleteFiles(array $files)
    {
        $count = 0;
        try {
            foreach ($files as $file) {
                $this->sevenZip->delEntry($file);
                $count++;
            }
            return $count;
        } catch (Exception $e) {
            throw new Exception('Could not modify archive: '.$e->getMessage(), $e->getCode(), $e);
        }
    }
797945
protected function iterateOverFiles($files)
    {
        foreach ($files as $file) {
            $file = $this->getFile($file);

            if ($namespace = $this->extractNamespace($file)) {
                $this->checkInstance($file, $namespace);
            }
        }
    }
1373586
public function delete($paths)
		{
			$paths = Arrays::is($paths) ? $paths : func_get_args();

			$success = true;

			foreach ($paths as $path) { if ( ! @unlink($path)) $success = false; }

			return $success;
		}
297339
public static function incrUpdateRuntime($files)
    {
        $parser = Annotation::getInstance()->getParser();
        $parser->parseIncr($files);

        AnnotationManager::setAnnotations([]);
        AnnotationManager::setAnnotationRelation([]);

        foreach(App::getRuntimeInfo()->parsersData as $parserClass => $data)
        {
            $parserObject = $parserClass::getInstance();
            $parserObject->setData([]);
        }

        foreach($parser->getData() as $className => $item)
        {
            $parser->execParse($className);
        }
    }
1055469
public static function removeFile(string $file): void
    {
        if (\is_file($file)) {
            if (!@\unlink($file)) {
                throw new \RuntimeException(\sprintf('Unable to delete file "%s"%s', $file, self::getErrorInfo()));
            }
        }
        
        \clearstatcache(true, $file);
    }
198490
public function delete( ... $paths ): bool
	{
		$all = 0;
		$removed = 0;
		if( count($paths) === 1 && is_array($paths[0]) )
		{
			$paths = $paths[0];
		}

		foreach( $paths as $path )
		{
			++ $all;
			$this->deleteOnce( (string) $path ) && ++ $removed;
		}

		return $all === $removed;
	}