CASM
AClustersApproachtoStatisticalMechanics
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules
DirectoryStructure.cc
Go to the documentation of this file.
2 #include "casm/casm_io/Log.hh"
3 
4 namespace CASM {
5 
7  void recurs_rm_files(fs::path p, bool dry_run, Log &log) {
8  if(!fs::exists(p)) {
9  return;
10  }
11 
12  auto it = fs::directory_iterator(p);
13  auto end = fs::directory_iterator();
14 
15  for(; it != end; ++it) {
16  if(fs::is_regular_file(*it)) {
17  log << "rm " << *it << std::endl;
18  if(!dry_run) {
19  fs::remove(*it);
20  }
21  }
22  else {
23  recurs_rm_files(*it, dry_run, log);
24  log << "rm " << *it << std::endl;
25  }
26  }
27 
28  log << "rm " << p << std::endl;
29  if(!dry_run) {
30  fs::remove(p);
31  }
32  }
33 
34 }
35 
Main CASM namespace.
Definition: complete.cpp:8
Log & log
Definition: settings.cc:105
void recurs_rm_files(fs::path p, bool dry_run, Log &log)
Remove files recursively.
Definition: Log.hh:9