-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFileExplorer.h
69 lines (49 loc) · 1.06 KB
/
FileExplorer.h
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
//
// Created by marcelghisi on 15/09/22.
//
#ifndef MY_FTP_FILEEXPLORER_H
#define MY_FTP_FILEEXPLORER_H
#include <string>
#include <vector>
#include <utility>
class FileExplorer {
public:
explicit FileExplorer(std::string root_dir): dir("/"){
if (root_dir[root_dir.size() - 1] == '/'){
root_dir.pop_back();
}
root = root_dir;
}
std::vector<std::string> ls(const std::string &dir) ;
/*LIST
* */
bool rm(const std::string &filename);
/* DELE
* */
uint64_t size(const std::string &filename);
/* SIZE
* */
bool mkdir(std::string path_namedir);
/* MKD
* */
bool rmdir(std::string path_name);
/* RMD
* */
bool move(const std::string &what_path, std::string &path_to);
/* RNFR RNTO
* */
std::string pwd();
/* PWD
* */
std::string root_dir();
std::string cd_up();
/* CDUP
* */
bool cd(std::string next_dir);
/* CWD
* */
private:
std::string root;
std::string dir;
};
#endif //MY_FTP_FILEEXPLORER_H