Jpp  master_rocky-43-ge265d140c
the software that should make you happy
rename.cc
Go to the documentation of this file.
1 #include <string>
2 
3 #include "JSystem/JFilesystem.hh"
4 
5 #include "Jeep/JParser.hh"
6 
7 
8 /**
9  * \file
10  *
11  * Rename file.
12  *
13  * \author mdejong
14  */
15 int main(int argc, char* argv[])
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
Utility class to parse command line options.
#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
int main(int argc, char *argv[])
Definition: rename.cc:15