function removeFolder(ctx, cbs){ try{ var path = null; if(this.cfg.source){ path = ctx.getObjectValueByString(this.cfg.source); }else{ if(this.cfg.path){ path = this.cfg.path; } } if(path){ if(fs.pathExistsSync(path)){ fs.rmdirSync(path); if(cbs && cbs.success){ cbs.success(ctx); } }else{ if(cbs && cbs.success){ cbs.success(ctx); } } }else{ if(cbs && cbs.error){ cbs.error(new Error("No Path Supplied")); } } }catch(e){ if(cbs && cbs.error){ cbs.error(e); } } }
function renameFolder(ctx, cbs){ try{ var path = null; var newName = null; if(this.cfg.path_source){ path = ctx.getObjectValueByString(this.cfg.path_source); }else{ if(this.cfg.path){ path = this.cfg.path; } } if(this.cfg.name_source){ newName = ctx.getObjectValueByString(this.cfg.name_source); } if(path && newName){ if(fs.pathExistsSync(path)){ fs.renameSync(path, newName); if(cbs && cbs.success){ cbs.success(ctx); } }else{ if(cbs && cbs.success){ cbs.success(ctx); } } }else{ if(cbs && cbs.error){ cbs.error(new Error("No Path Supplied")); } } }catch(e){ if(cbs && cbs.error){ cbs.error(e); } } }