-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclean.cpp
51 lines (41 loc) · 926 Bytes
/
clean.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
45
46
47
48
49
50
51
/*#include <iostream>
#include <stdlib.h>
#include <unistd.h>
#include <sstream>
#include <string.h>
#include <errno.h>
#include <signal.h>
#include <cstdio>
using namespace std;
void del(string name) {
string workdir = "/home/luolei/code/crawler/";
string currdir;
string cmd;
currdir = workdir + name;
cout << currdir << endl;
if (access(currdir.c_str(), 0)) {
cerr << "can not read dir: " << currdir <<" reason:"<<strerror(errno)<< endl;
exit(-1);
}
chdir(currdir.c_str());
cmd = " rm * ";
cout << "system : " << cmd << endl;
system(cmd.c_str());
}
string integer2string(const int n) {
stringstream newstr(stringstream::in | stringstream::out);
newstr << n;
return newstr.str();
}
int main() {
del("DocFPs/");
del("HTMLFiles/");
del("QueueFiles/");
del("URLSet/");
for(int i=0; i<100; i++){
string name("Header/");
name = name + integer2string(i) + "/";
del(name);
}
return 0;
}*/