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

Classes

struct  RootMkdirArgs

Functions

static bool IsDirectory (const TKey &key)
int main (int argc, char **argv)
static bool MakeDirectory (TFile &file, std::string_view dirPath, bool createParents)
static RootMkdirArgs ParseArgs (const char **args, int nArgs)
static bool ValidateDirPath (std::string_view path)

Variables

static const char *const kLongHelp
static const char *const kShortHelp = "usage: rootmkdir [-p|--parents] [-v|--verbose] FILE:path/to/dir [...]\n"

Detailed Description

Command line tool to create directories in 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-03-06

Definition in file rootmkdir.cxx.

Function Documentation

◆ IsDirectory()

bool IsDirectory ( const TKey & key)
static

Definition at line 108 of file rootmkdir.cxx.

◆ main()

int main ( int argc,
char ** argv )

Definition at line 183 of file rootmkdir.cxx.

◆ MakeDirectory()

bool MakeDirectory ( TFile & file,
std::string_view dirPath,
bool createParents )
static

Definition at line 115 of file rootmkdir.cxx.

◆ ParseArgs()

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

Definition at line 71 of file rootmkdir.cxx.

◆ ValidateDirPath()

bool ValidateDirPath ( std::string_view path)
static

Definition at line 174 of file rootmkdir.cxx.

Variable Documentation

◆ kLongHelp

const char* const kLongHelp
static
Initial value:
= R"(
Add directories in ROOT files
positional arguments:
FILE:path File(s) and path(s) of directories to create
options:
-h, --help get this help
-p, --parents create parent directories if needed, no error if directory already exists
-v, --verbose be verbose (can be repeated for increased verbosity)
Note that calling rootmkdir without a directory path can be used to create files (similar to the `touch` command).
You can also simultaneously create files and directories in it if you pass the -p flag.
examples:
- rootmkdir example.root:dir
Add the directory 'dir' to the ROOT file 'example.root' (file must exists)
- rootmkdir example.root:dir1/dir2
Add the directory 'dir2' in 'dir1' which exists in the ROOT file 'example.root'
- rootmkdir -p example.root:dir1/dir2/dir3
Make parent directories of 'dir3' as needed, no error if target directory already exists
- rootmkdir non_existent.root
Create an empty ROOT file named 'non_existent.root'
- rootmkdir -p non_existent.root:dir1
Create a ROOT file named 'non_existent.root' and directory `dir1` in it
)"

Definition at line 29 of file rootmkdir.cxx.

◆ kShortHelp

const char* const kShortHelp = "usage: rootmkdir [-p|--parents] [-v|--verbose] FILE:path/to/dir [...]\n"
static

Definition at line 28 of file rootmkdir.cxx.