/*
Remove sub folder from requestedPath if defined
331031
private function extractFolder(string $requestPath, string $folder) : string
    {
        if (!empty($folder)) {
            $requestPath = '/' . trim((string) preg_replace('#^/' . $folder . '#msi', '/', $requestPath), '/');
        }
        if ($requestPath === '') {
            $requestPath = '/';
        }
        return $requestPath;
    }
564402
def remove(parent, idx):
  """"""
  if isinstance(parent, dict):
    del parent[idx]
  elif isinstance(parent, list):
    del parent[int(idx)]
  else:
    raise JSONPathError("Invalid path for operation")
32227
function deleteFn (req, res, next) {
    var reqPath = req.params[0];
    debug('deleteFn', 'reqPath', reqPath);

    rimraf(path.join(ramlPath, reqPath), function (err) {
      if (err) return next(err);
      res.sendStatus(200);
    });
  }
598388
function deleteOldFiles(path){

      var deferred = Q.defer();

      // Don't delete existing files & folders if overwrite is off
      if(options.overWrite !== false){

        grunt.log.writeln('---> Deleting folder ==> '+path);

        rimraf(path,  function(err){
          if(err) {
            grunt.log.warn('---> There was an error deleting the existing repo folder : '+path+', error : '+err);
            deferred.reject(err);
          }else{
            deferred.resolve();
          }
        });

      }else{
        if(grunt.file.isDir(path)){
          grunt.log.writeln('---> Folder exists so plugin will not overwrite ==> '+path);
        }
        deferred.resolve();
      }

      return deferred.promise;

    }
827435
function path2FolderName(filePath, keepTailSlash){
		var pathSegs = filePath.split("/");
		pathSegs.splice(pathSegs.length -1, 1);
		return keepTailSlash ? pathSegs.join("/") + "/" : pathSegs.join("/");
	}
63498
function cleanDir( path ) {
    var files = FS.readdirSync( path );
    try {
        files.forEach( function ( file ) {
            var fullpath = Path.join( path, file );
            if ( !FS.existsSync( fullpath ) ) return;
            var stat = FS.statSync( fullpath );
            try {
                if ( stat.isDirectory() ) PathUtils.rmdir( fullpath );
                else FS.unlinkSync( fullpath );
            } catch ( ex ) {
                console.error( "Unable to delete `" + fullpath + "`!" );
                console.error( ex );
            }
        } );
    } catch ( ex ) {
        fatal( "Fatal error in function `files`!\n" + JSON.stringify( ex, null, '  ' ) );
    }
}
103699
public void removeFolder(String folder) {

        m_searchObject.removeFolder(folder);
        m_searchObjectChanged = true;
        ValueChangeEvent.fire(this, m_searchObject);
    }
1177880
def remove(path):
    
    if os.path.isdir(path):
        return __rmtree(path)
    else:
        return __rmfile(path)
927400
private function removePath(string $path): void
    {
        if (false !== strpos($path, '*')) {
            $paths = glob($path);
            foreach ($paths as $path) {
                $this->removePath($path);
            }
        } else {
            if (is_dir($path)) {
                $iterator = new \RecursiveDirectoryIterator($path);
                $iterator = new \RecursiveIteratorIterator($iterator, \RecursiveIteratorIterator::CHILD_FIRST);
                /** @var \SplFileInfo $file */
                foreach ($iterator as $file) {
                    if ('.' === $file->getBasename() || '..' === $file->getBasename()) {
                        continue;
                    }
                    if ($file->isLink() || $file->isFile()) {
                        unlink($file->getPathname());
                    } else {
                        rmdir($file->getPathname());
                    }
                }
                rmdir($path);
            } else {
                if (is_file($path)) {
                    unlink($path);
                }
            }
        }
    }
1133602
def remove(path):
    '''
    
    '''
    try:
        os.remove(path)
    except OSError as exc:
        if exc.errno != errno.ENOENT:
            raise
1317539
def force_delete_file(file_path):
        '''  '''
        if os.path.isfile(file_path):
            try:
                os.remove(file_path)
                return file_path
            except:           
                return FileSystemUtils.add_unique_postfix(file_path)
        else:
            return file_path
366451
def __remove_path(self, path):
        
        curpath = os.path.abspath(os.curdir)
        if not os.path.exists(path):
            logger.warn("Attempted to remove a non-existent path %s" % path)
            return
        try:
            if os.path.islink(path):
                os.unlink(path)
            elif os.path.isdir(path):
                shutil.rmtree(path)
            else:
                os.unlink(path)

            # in the case we just deleted ourselves out of a valid directory,
            # we move to a valid directory.
            if curpath == path:
                os.chdir(tempfile.gettempdir())

        except OSError:
            logger.error("Unable to remove object at path %s" % path)
            raise DirectoryException("Unable to remove object at path %s" % path)
455408
function removeExisting ()
{
    if (fs.existsSync("web/assets"))
    {
        var stat = fs.lstatSync("web/assets");

        if (stat.isFile() || stat.isSymbolicLink())
        {
            fs.unlinkSync("web/assets");
        }
        else
        {
            wrench.rmdirSyncRecursive("web/assets");
        }
    }
}
1315729
def remove_from_pythonpath(self, path):
        """"""
        pathlist = self.get_pythonpath()
        if path in pathlist:
            pathlist.pop(pathlist.index(path))
            self.set_pythonpath(pathlist)
            return True
        else:
            return False
1213190
function (req, res, next) {
                    req.mounted = true
                    req.url     = req.url.replace(remove, '')

                    // clear cached req.path
                    delete req._path
                    delete req._pathLength

                    next()
                }
532208
function removeExtensionDir(done) {
            if (!self.dir) return done(null);

            rimraf(self.dir, done);
        }
383311
function FolderPath(value) {
  if (!(this instanceof FolderPath)) {
    return new FolderPath(value);
  }
  if (Array.isArray(value)) {
    this.value = value;
  } else if (typeof value === 'string') {
    if (value.match('^https?:\/\/')) {
      this.value = parseName(value);
    } else {
      this.value = value.split('/').filter(Boolean);
    }
  } else {
    this.value = [];
  }
}