Logo ROOT  
Reference Guide
Loading...
Searching...
No Matches
rootrm.cxx File Reference
#include <ROOT/RLogger.hxx>
#include "logging.hxx"
#include "optparse.hxx"
#include "RootObjTree.hxx"
#include "RootObjTree.cxx"
#include <TClass.h>
#include <TError.h>
#include <TFile.h>
#include <TROOT.h>
#include <TSystem.h>
#include <algorithm>
#include <iostream>
#include <memory>
#include <string_view>
#include <vector>
Include dependency graph for rootrm.cxx:

Classes

struct  RootRmArgs

Functions

int main (int argc, char **argv)
static RootRmArgs ParseArgs (const char **args, int nArgs)
static bool PromptForRemoval (std::string_view fileName, std::string_view objName)
static bool RemoveNode (RootSource &src, NodeIdx_t nodeIdx, const RootRmArgs &args)

Variables

static const char *const kLongHelp
static const char *const kShortHelp

Detailed Description

Command line tool to remove objects from ROOT files.

Author
Giacomo Parolini giaco.nosp@m.mo.p.nosp@m.aroli.nosp@m.ni@c.nosp@m.ern.c.nosp@m.h
Date
2026-02-18

Definition in file rootrm.cxx.

Function Documentation

◆ main()

int main ( int argc,
char ** argv )

Definition at line 181 of file rootrm.cxx.

◆ ParseArgs()

RootRmArgs ParseArgs ( const char ** args,
int nArgs )
static

Definition at line 72 of file rootrm.cxx.

◆ PromptForRemoval()

bool PromptForRemoval ( std::string_view fileName,
std::string_view objName )
static

Definition at line 122 of file rootrm.cxx.

◆ RemoveNode()

bool RemoveNode ( RootSource & src,
NodeIdx_t nodeIdx,
const RootRmArgs & args )
static

Definition at line 134 of file rootrm.cxx.

Variable Documentation

◆ kLongHelp

const char* const kLongHelp
static
Initial value:
= R"(
Remove objects from ROOT files
positional arguments:
FILE:path File(s) and path of objects to remove
options:
-f, --force ignore nonexistent files and arguments, never prompt
-h, --help show this help message and exit
-i, --interactive prompt before deleting each object
-n, --dry-run show what would be removed, but don't actually remove anything. Implies `-v`.
-r, --recursive recurse inside directories
-v, --verbose be verbose (can be repeated for increased verbosity)
examples:
- rootrm example.root:hist
Remove the object 'hist' from the ROOT file 'example.root'
- rootrm example.root:dir/hist
Remove the object 'hist' from the directory 'dir' inside the ROOT file 'example.root'
- rootrm example.root
Remove the ROOT file 'example.root'
- rootrm -i example.root:hist
Display a confirmation request before deleting: 'remove 'hist' from 'example.root' ? (y/n) :'
)"

Definition at line 30 of file rootrm.cxx.

◆ kShortHelp

const char* const kShortHelp
static
Initial value:
= "usage: rootrm [-h] [-i|--interactive] [-r|--recursive] "
"[-v|--verbose] FILE[:path/to/obj] [...]\n"

Definition at line 28 of file rootrm.cxx.