Jpp  master_rocky-40-g5f0272dcd
the software that should make you happy
Functions
rename.cc File Reference

Rename file. More...

#include <string>
#include "JSystem/JFilesystem.hh"
#include "Jeep/JParser.hh"

Go to the source code of this file.

Functions

int main (int argc, char *argv[])
 

Detailed Description

Rename file.

Author
mdejong

Definition in file rename.cc.

Function Documentation

◆ main()

int main ( int  argc,
char *  argv[] 
)

Definition at line 15 of file rename.cc.

16 {
17  using namespace std;
18  using namespace JPP;
19 
20  string inputFile;
21  string outputFile;
22 
23  try {
24 
25  JParser<> zap;
26 
27  zap['f'] = make_field(inputFile);
28  zap['o'] = make_field(outputFile);
29 
30  zap(argc, argv);
31  }
32  catch(const exception& error) {
33  FATAL(error.what() << endl);
34  }
35 
36  const int ierr = rename(inputFile, outputFile);
37 
38  if (ierr != 0) {
39  FATAL("Error renaming " << ierr << endl);
40  }
41 }
string outputFile
#define FATAL(A)
Definition: JMessage.hh:67
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:2142
Utility class to parse command line options.
Definition: JParser.hh:1698
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
int rename(const std::string &inputFile, const std::string &outputFile)
Rename file across file systems.
Definition: JFilesystem.hh:49
Definition: JSTDTypes.hh:14