Abstract: An efficient method for renaming consecutive keys in a B-tree representing a hierarchical namespace, such as a file system, has an estimated time efficiency of O(logN), where N is the number of nodes in the B-tree. All the consecutive keys to be renamed are first excised from the original B-tree to form a trimmed B-tree, and the excised nodes are stored in a separate temporary extracted B-tree. The nodes in extracted B-tree are then renamed, and the renamed extracted B-tree is inserted into the trimmed B-tree to form a final B-tree that contains the renamed keys.