TDirectory *subdir = (TDirectory*)gDirectory->Get("subdirectory"); //assuming subdirectory exists subdir->cd();
TDirectory *parentdir = (TDirectory*)gDirectory->Get(".."); //assuming parent directory is accessible parentdir->cd();This code retrieves the parent directory object by specifying ".." as the directory name. Then it changes the current directory to that parent directory. Package library: ROOT (CERN)