-
Notifications
You must be signed in to change notification settings - Fork 1
/
remove_files.cpp
44 lines (40 loc) · 1.01 KB
/
remove_files.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include <iostream>
#include <cstdio>
#include <list>
#include <vector>
#include <map>
#include <string>
#include <cstring>
#include <cassert>
#include <fstream>
#include <queue>
#include <sstream>
#include <stdexcept>
#include <tuple>
#include <algorithm>
#include <iterator>
#include <chrono>
#include <set>
#include <utility>
#include <math.h>
using Clock = std::chrono::steady_clock;
using std::chrono::time_point;
using std::chrono::duration_cast;
using std::chrono::milliseconds;
using namespace std;
int main(int argc, char** argv){
cout<<"remove_files.cpp "<<argc<<"\n";
string listing_filename = argv[1];
short remove_start = static_cast<short>(stoi(argv[2]));
short remove_offset = static_cast<short>(stoi(argv[3]));
unsigned long current_idx=0, to_remove_idx = remove_start;
string text;
ifstream input_file(listing_filename);
while (getline( input_file, text )){
if(current_idx++ == to_remove_idx){
remove(text.c_str());
to_remove_idx += remove_offset;
}
}
return 0;
}