Clears the directory.

@param string $path
430331
protected function clearDir($path)
    {
        $items = [];
        $finder = new Finder();
        $finder->in($path)
            ->ignoreVCS(false)
            ->ignoreDotFiles(false);

        foreach ($finder as $item) {
            $items[] = $item->getRealpath();
        }

        if (count($items) > 0) {
            $this->fs->remove($items);
        }
    }
291034
public function resetPath($path = '')
    {
        $this->blob = (new Blob($this->package))->setPath($path);

        // Ensure that user folder exists on first load
        $userFolder = Str::normalizePath(config('cripfilesys.user_folder'));
        if ($this->blob->path == $userFolder) {
            $this->makeDirectory();
        }
    }
1199167
public function removeAutomaticallyRemovedPath($path)
    {
        array_remove_value($this->automaticallyRemovedPaths, $path);
        $this->automaticallyRemovedPaths = array_values($this->automaticallyRemovedPaths);
    }
981262
public function delete($path) {
		$this->connectIfNeeded();
		$this->handle->delete($path);
		$this->onFileDeleted(new Event(['sender' => $this, 'data' => $path]));
	}
996967
public static function delete($path)
  {
    if (is_file($path)) {
      return unlink($path);
    }

    $files = array_diff(scandir($path), array('.', '..'));

    foreach ($files as $file) {
      (is_dir("$path/$file")) ? Filesystem::delete("$path/$file") : unlink("$path/$file");
    }

    return rmdir($path);
  }
711059
public function deleteRecursive($path)
	{
		if (!$this->tryDelete($path)) {
			foreach ((array) $this->nlist($path) as $file) {
				if ($file !== '.' && $file !== '..') {
					$this->deleteRecursive(strpos($file, '/') === FALSE ? "$path/$file" : $file);
				}
			}
			$this->rmdir($path);
		}
	}
1293813
private function deleteFiles(Directory $path)
    {
        foreach ($this->manager->findFiles($path) as $file) {
            $this->wrapper->delete($file->getRealpath());
        }
    }
719409
public static function clear($path = null) {
		if (empty($path)) {
			self::$_items = array();
			return;
		}

		if (Hash::check(self::$_items, $path)) {
			self::$_items = Hash::insert(self::$_items, $path, array());
		}
	}
1019216
private function remove_dir($path){
        if( is_dir($path) ){
            foreach( scandir($path) as $file ){
                if( $file != '.' && $file != '..' ){
                    if( is_dir("{$path}/{$file}") ){
                        $this->remove_dir("{$path}/{$file}");
                    }else{
                        @unlink("{$path}/{$file}");
                    }
                }
            }
            @rmdir($path);
        }
    }
950097
public function delete($path)
    {
        $node = $this->getNodeForPath($path);
        $node->delete();

        list($parent) = Uri\split($path);
        $this->markDirty($parent);
    }
703103
def clear(self):
        '''
        
        '''
        if os.path.exists(self.path):
            os.remove(self.path)
1199044
public function deleteDirectory($path)
    {
        if (false === $this->exists($path)) {
            return $this;
        }

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

        return $this;
    }
841684
protected function makeDirectory($path)
    {
        if (! $this->getFiles()->isDirectory(dirname($path))) {
            
            $this->getFiles()->makeDirectory(dirname($path), 0777, true, true);
        }
    }
16927
private static function rmdirRecursive($path)
    {
        $files = scandir($path);
        array_shift($files);
        array_shift($files);

        foreach ($files as $file) {
            $file = $path.DIRECTORY_SEPARATOR.$file;
            if (is_dir($file)) {
                self::rmdirRecursive($file);
            } else {
                unlink($file);
            }
        }

        rmdir($path);
    }
1048239
protected function _clearPath($path, $targets)
    {
        if (!file_exists($path)) {
            $this->verbose("Not clearing '$path' it does not exist.");
            return;
        }

        $dir = new DirectoryIterator($path);
        foreach ($dir as $file) {
            $name = $base = $file->getFilename();
            if (in_array($name, array('.', '..'))) {
                continue;
            }
            // timestampped files.
            if (preg_match('/^(.*)\.v\d+(\.[a-z]+)$/', $name, $matches)) {
                $base = $matches[1] . $matches[2];
            }
            if (in_array($base, $targets)) {
                $this->verbose(' - Deleting ' . $path . $name, '.');
                unlink($path . $name);
                continue;
            }
        }
    }
853565
public static function clear_directory($directory)
    {
        foreach (scandir($directory) as $file) {
            if ($file !== '.' and $file !== '..') {
                unlink($directory.$file);
            }
        }
    }
630684
public function cleanDirectory($path)
    {
        $time = time();
        $maxFileAge = 3600;
        $files = (array) $this->files->files($path);
        foreach ($files as $file) {
            if ($this->files->isFile($file) === true &&
                $this->files->lastModified($file) < ($time - $maxFileAge)
            ) {
                $this->files->delete($file);
            }
        }

        return $this;
    }