node js get parent folder from file path code example Example: get dirname to last directory node path.basename(path.dirname(filename))