Make sure, that blank directories are removed from the storage.

        Args:
            path (str): Path which you suspect that is blank.
341510
def _recursive_remove_blank_dirs(self, path):
        
        path = os.path.abspath(path)

        # never delete root of the storage or smaller paths
        if path == self.path or len(path) <= len(self.path):
            return

        # if the path doesn't exists, go one level upper
        if not os.path.exists(path):
            return self._recursive_remove_blank_dirs(
                os.path.dirname(path)
            )

        # if the directory contains files, end yourself
        if os.listdir(path):
            return

        # blank directories can be removed
        shutil.rmtree(path)

        # go one level up, check whether the directory is blank too
        return self._recursive_remove_blank_dirs(
            os.path.dirname(path)
        )
560790
protected boolean createDirectoryIfNotExists(Path path) throws IOException {
        if(!Files.exists(path)) {
            Files.createDirectories(path);
            return true;
        }
        else {
            return false;
        }
    }
1186184
def exit_if_path_not_found(path):
    
    if not os.path.exists(path):
        ui.error(c.MESSAGES["path_missing"], path)
        sys.exit(1)
571704
def makedirs(self, path):
        
        root = ""

        assert path.startswith('/')
        p = path.strip('/')
        for item in p.split('/'):
            root += "/" + item
            if not self.exists(root):
                self.makedir(root)

        return self.find(path)
1007415
def ensure_dir(path):
        
        try:
            makedirs(path)
        except OSError as e:  # pragma: no cover
            if e.errno == errno.EEXIST and isdir(path):
                return (True, 'exists')
            else:
                return (False, e)
        return (True, path)
982040
def remove_empty(fs, path):
    # type: (FS, Text) -> None
    
    path = abspath(normpath(path))
    try:
        while path not in ("", "/"):
            fs.removedir(path)
            path = dirname(path)
    except DirectoryNotEmpty:
        pass
416011
def check(self, init_if_missing=False):
        
        for d in self.path_overrides + [self.inputdir]:            
            if os.path.exists(d):
                self.allpaths.append(d)
        if len(self.allpaths) > 0:
            return(True)

        if init_if_missing:
            os.makedirs(self.inputdir)
            return True
572860
def clean_tmpdir(path):
    """"""
    if os.path.exists(path) and \
       os.path.isdir(path):
        rmtree(path)
1177880
def remove(path):
    
    if os.path.isdir(path):
        return __rmtree(path)
    else:
        return __rmfile(path)
884903
def ensure_dir(self, *path_parts):
        
        path = self.getpath(*path_parts)
        ensure_directory(path)
        return path
1109922
def rm(path):
    
    if path and os.path.exists(path):
        if os.path.isdir(path):
            shutil.rmtree(path)
        else:
            os.remove(path)
280946
public static void ensureDirectoryExists(final Path path) throws IOException {
        if (Files.exists(path)) {
            if (!Files.isDirectory(path)) {
                throw new IOException("path is not a directory: " + path);
            }
            // probably should fsync parent here just to be sure, but that might slow stuff down
        } else {
            Files.createDirectories(path);
            fsyncLineage(path.getParent());
        }
    }
1299838
def empty_directory(self):
        """"""
        for child in self.walkfiles():
            child.remove()
        for child in reversed([d for d in self.walkdirs()]):
            if child == self or not child.isdir():
                continue
            child.rmdir()
1331432
private void cleanIndexDirectory(String path) throws IOException
   {
      SecurityHelper.doPrivilegedIOExceptionAction((PrivilegedExceptionAction<Void>) () -> {
         File newIndexFolder = new File(path);
         if(newIndexFolder.exists())
         {
            DirectoryHelper.removeDirectory(newIndexFolder);
         }
         return null;
      });
   }
670495
def make_sure_path_exists(self, path):
        
        try:
            os.makedirs(path)
        except OSError as exception:
            if exception.errno != errno.EEXIST:
                raise
792153
def isdir(self, path):
        
        try:
            self.remote_context.check_output(["test", "-d", path])
        except subprocess.CalledProcessError as e:
            if e.returncode == 1:
                return False
            else:
                raise
        return True
317477
def path_is_empty(p: tcod.path.AStar) -> bool:
    
    return bool(lib.TCOD_path_is_empty(p._path_c))