bash: $ rm -rf <path>

@name typeSync
@param {String} p delete path
@param {String} f path.resolve#from
@memberof fsys
@method
185394
function (p, f) {
        var self = this;
        f = f || '';
        p = path.resolve(f, path.normalize(p));
        if (this.typeSync(p) === this.TYPE.DIRECTORY) {
            _.each(fs.readdirSync(p), function(f) {
                self.rmrfSync(path.join(p, f));
            });
            return fs.rmdirSync(p);
        }
        return fs.unlinkSync(p);
    }
156482
function polpetta_resolve(src) {
  src = path.resolve(
    root + systemPath(src)
  );
  // root must be at index 0
  return src.indexOf(root) ? "" : src;
}
788506
function _gpfPathJoin (path) {
    var splitPath = _gpfPathDecompose(path);
    _gpfArrayTail(arguments).forEach(_gpfPathAppend.bind(null, splitPath));
    return splitPath.join("/");
}
594980
function resolveSync(p, base, root) {
  if (!path.isAbsolute(p)) {
    p = path.resolve(path.resolve(root, base), p);
  }
  return p;
}
533880
function mkDir(p, mode = 0777) {
    if (fs.existsSync(p)) {
        chmod(p, mode);
        return true;
    } else {
        if (mkDir(path.dirname(p))) {
            fs.mkdirSync(p, mode);
            return true;
        }
    }
}
1026758
function mkSrc(p) {
    var src = {};
    if (typeof p.inject === 'string') { src.async = p.inject; }
    src.path = fspath.extname(p.route) ?
               p.route :
               ppath.join(p.route || '/', fspath.basename(p.path));
    return src;
  }
1062454
function( path, callback ) {
		var match = munit.isRegExp( render.options.file_match ) ? render.options.file_match : rtestfile;

		path += '/';
		fs.readdir( path, function( e, files ) {
			if ( e ) {
				return callback( e );
			}

			async.each( files || [],
				function( file, callback ) {
					var fullpath = path + file;

					fs.stat( fullpath, function( e, stat ) {
						if ( e ) {
							callback( e );
						}
						else if ( stat.isDirectory() ) {
							render._renderPath( fullpath, callback );
						}
						else {
							if ( stat.isFile() && match.exec( file ) ) {
								munit.require( fullpath );
							}

							callback();
						}
					});
				},
				callback
			);
		});
	}
1156226
function(fsPath, strict) {
		if (!_.isString(fsPath)) {
			throw new TypeError('path must be of type string');
		}
		return fsPath === module.exports.reformatPath(fsPath, strict);
	}
1266285
function _mkdirpSync (directory, mode) {

			if ("undefined" === typeof directory) {
				throw new ReferenceError("missing \"directory\" argument");
			}
				else if ("string" !== typeof directory) {
					throw new TypeError("\"directory\" argument is not a string");
				}
				else if ("" === directory.trim()) {
					throw new Error("\"directory\" argument is empty");
				}
			else if ("undefined" !== typeof mode && "number" !== typeof mode) {
				throw new TypeError("\"mode\" argument is not a number");
			}
			else if (!isDirectorySync(directory)) {

				const SUB_DIRECTORY = dirname(directory);

				if (!isDirectorySync(SUB_DIRECTORY)) {
					_mkdirpSync(SUB_DIRECTORY);
				}

				mkdirSync(directory, mode ? mode : DEFAULT_OPTION);

			}

		}
124876
function rm(changeList, property, index, count, a) {
        var finalIndex = index ? index - count + 1 : 0
        changeList.push({
            type:'rm',
            path: property,
            index: finalIndex,
            num: count,
            vals: a.slice(finalIndex, finalIndex+count)
        })
    }
928945
function handler(isSync) {
    /**
     * lnf
     * Creates or overrides a symlink.
     *
     * @name lnf
     * @function
     * @param {String} target The target file. The path is relative to the `dstpath`.
     * @param {String} dstpath The path where the symlinks will be created or overriden.
     * @param {String} type The symlink type.
     * @param {Function} callback The callback function
     * @return {undefined}
     */
    var lnf = function (target, dstpath, type, callback) {

        if (typeof type === "function") {
            callback = type;
            type = undefined;
        }

        callback = callback || function (err) {
            if (err) { throw err; }
        };

        function res(err) {

            if (err && err.code === "EEXIST") {
                if (isSync) {
                    Fs.unlinkSync(dstpath);
                    lnf(target, dstpath, type, callback);
                } else {
                    Fs.unlink(dstpath, function (err) {
                        if (err) { return callback(err); }
                        lnf(target, dstpath, type, callback);
                    });
                }
                return;
            }

            callback(err);
        }

        if (isSync) {
            try {
                Fs.symlinkSync(target, dstpath, type);
            } catch (err) {
                return res(err);
            }
        } else {
            Fs.symlink(target, dstpath, type, res);
        }
    };
    return lnf;
}
1179547
function _gpfReadPhantomJS (path) {
    return new Promise(function (resolve, reject) {
        try {
            resolve(_gpfNodeFs.read(path));
        } catch (e) {
            // Error is a string
            reject(new Error(e));
        }
    });
}
166517
def rm_rf(path, dry_run=False):
    
    log.info("removing %s" % path)
    if dry_run:
        return
    try:
        if os.path.isdir(path) and not os.path.islink(path):
            shutil.rmtree(path)
        else:
            os.remove(path)
    except OSError:
        pass
1272751
function rimraf(dirPath) {
  if (fs.existsSync(dirPath)) {
    fs.readdirSync(dirPath).forEach((entry) => {
      const entryPath = path.join(dirPath, entry);
      if (fs.lstatSync(entryPath).isDirectory()) {
        rimraf(entryPath);
      } else {
        fs.unlinkSync(entryPath);
      }
    });
    fs.rmdirSync(dirPath);
  }
}
1174480
function(relativePath) {
    const folder = setupHelper.setupFolderAbsolutePath() + '/' + relativePath;
    return setupHelper.handleShellResponse(shell.exec('rm -rf ' + folder));
  }
131629
function(files, target, fm, isDir) {
			var dfrd = $.Deferred(),
				names, renames = [], hashes = {}, chkFiles = [],
				cancel = function() {
					var i = files.length;
					while (--i > -1) {
						files[i]._remove = true;
					}
				},
				resolve = function() {
					dfrd.resolve(renames, hashes);
				},
				check = function() {
					var existed = [], exists = [], i, c,
						pathStr = target !== fm.cwd().hash? fm.path(target, true) + fm.option('separator', target) : '',
						confirm = function(ndx) {
							var last = ndx == exists.length-1,
								opts = {
									cssClass : 'elfinder-confirm-upload',
									title  : fm.i18n('cmdupload'),
									text   : ['errExists', pathStr + exists[ndx].name, 'confirmRepl'], 
									all    : !last,
									accept : {
										label    : 'btnYes',
										callback : function(all) {
											!last && !all
												? confirm(++ndx)
												: resolve();
										}
									},
									reject : {
										label    : 'btnNo',
										callback : function(all) {
											var i;
			
											if (all) {
												i = exists.length;
												while (ndx < i--) {
													files[exists[i].i]._remove = true;
												}
											} else {
												files[exists[ndx].i]._remove = true;
											}
			
											!last && !all
												? confirm(++ndx)
												: resolve();
										}
									},
									cancel : {
										label    : 'btnCancel',
										callback : function() {
											cancel();
											resolve();
										}
									},
									buttons : [
										{
											label : 'btnBackup',
											cssClass : 'elfinder-confirm-btn-backup',
											callback : function(all) {
												var i;
												if (all) {
													i = exists.length;
													while (ndx < i--) {
														renames.push(exists[i].name);
													}
												} else {
													renames.push(exists[ndx].name);
												}
												!last && !all
													? confirm(++ndx)
													: resolve();
											}
										}
									]
								};
							
							if (!isDir) {
								opts.buttons.push({
									label : 'btnRename' + (last? '' : 'All'),
									cssClass : 'elfinder-confirm-btn-rename',
									callback : function() {
										renames = null;
										resolve();
									}
								});
							}
							if (fm.iframeCnt > 0) {
								delete opts.reject;
							}
							fm.confirm(opts);
						};
					
					if (! fm.file(target).read) {
						// for dropbox type
						resolve();
						return;
					}
					
					names = $.map(files, function(file, i) { return file.name && (!fm.UA.iOS || file.name !== 'image.jpg')? {i: i, name: file.name} : null ;});
					
					fm.request({
						data : {cmd : 'ls', target : target, intersect : $.map(names, function(item) { return item.name;})},
						notify : {type : 'preupload', cnt : 1, hideCnt : true},
						preventDefault : true
					})
					.done(function(data) {
						var existedArr, cwdItems;
						if (data) {
							if (data.error) {
								cancel();
							} else {
								if (fm.options.overwriteUploadConfirm && fm.option('uploadOverwrite', target)) {
									if (data.list) {
										if (Array.isArray(data.list)) {
											existed = data.list || [];
										} else {
											existedArr = [];
											existed = $.map(data.list, function(n) {
												if (typeof n === 'string') {
													return n;
												} else {
													// support to >=2.1.11 plugin Normalizer, Sanitizer
													existedArr = existedArr.concat(n);
													return false;
												}
											});
											if (existedArr.length) {
												existed = existed.concat(existedArr);
											}
											hashes = data.list;
										}
										exists = $.grep(names, function(name){
											return $.inArray(name.name, existed) !== -1 ? true : false ;
										});
										if (exists.length && existed.length && target == fm.cwd().hash) {
											cwdItems = $.map(fm.files(target), function(file) { return file.name; } );
											if ($.grep(existed, function(n) { 
												return $.inArray(n, cwdItems) === -1? true : false;
											}).length){
												fm.sync();
											}
										}
									}
								}
							}
						}
						if (exists.length > 0) {
							confirm(0);
						} else {
							resolve();
						}
					})
					.fail(function(error) {
						cancel();
						resolve();
						error && fm.error(error);
					});
				};
			if (fm.api >= 2.1 && typeof files[0] == 'object') {
				check();
			} else {
				resolve();
			}
			return dfrd;
		}
692817
function rmDir(p, reserve) {
    if (!isDir(p)) {
        return Promise.resolve(null);
    }
    let deferred = getDefer();
    fs.readdir(p, function (err, files) {
        if (err) {
            return deferred.reject(err);
        }
        let spromise = Promise.resolve(null);
        if (files.length > 0) {
            let promises = files.map(function (item) {
                let filePath = path.normalize(`${p}${path.sep}${item}`);
                if (isDir(filePath)) {
                    return rmDir(filePath, false);
                } else {
                    let defer = getDefer();
                    fs.unlink(filePath, function (er) {
                        return er ? defer.reject(er) : defer.resolve();
                    });
                    return defer.promise;
                }
            });
            spromise = Promise.all(promises);
        }

        return spromise.then(function () {
            if (!reserve) {
                let deferr = getDefer();
                fs.rmdir(p, function (e) {
                    return e ? deferr.reject(e) : deferr.resolve();
                });
                return deferr.promise;
            }
            return Promise.resolve();
        }).then(function () {
            deferred.resolve();
        }).catch(function (e) {
            deferred.reject(e);
        });
    });
    return deferred.promise;
}