private function cleanUp($path)
    {
        $fs = $this->getFilesystem();
        $parts = explode('/', $path);

        while (0 < count($parts)) {
            $key = implode('/', $parts);
            if ($fs->has($key)) {
                $dir = $fs->get($key);
                if (!$dir->isDir() || 0 < count($fs->listContents($key))) {
                    break;
                }
                if (!$fs->deleteDir($key)) {
                    throw new UploadException(sprintf('Failed to delete directory "%s".', $key));
                }
            }
            array_pop($parts);
        }
    }
private function cleanUp($path)
    {
        $fs = $this->getFilesystem();
        $parts = explode('/', $path);

        while (0 < count($parts)) {
            $key = implode('/', $parts);
            if ($fs->has($key)) {
                $dir = $fs->get($key);
                if (!$dir->isDir() || 0 < count($fs->listContents($key))) {
                    break;
                }
                if (!$fs->deleteDir($key)) {
                    throw new UploadException(sprintf('Failed to delete directory "%s".', $key));
                }
            }
            array_pop($parts);
        }
    }
private function cleanUp ( $ path ) { $ fs = $ this -> getFilesystem ( ) ; $ parts = explode ( '/' , $ path ) ; while ( 0 < count ( $ parts ) ) { $ key = implode ( '/' , $ parts ) ; if ( $ fs -> has ( $ key ) ) { $ dir = $ fs -> get ( $ key ) ; if ( ! $ dir -> isDir ( ) || 0 < count ( $ fs -> listContents ( $ key ) ) ) { break ; } if ( ! $ fs -> deleteDir ( $ key ) ) { throw new UploadException ( sprintf ( 'Failed to delete directory "%s".' , $ key ) ) ; } } array_pop ( $ parts ) ; } }
Removes the path directories if they are empty.

@param string $path
@throws UploadException
Removes the path directories if they are empty .