-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFileExploration.cpp
More file actions
64 lines (61 loc) · 1.07 KB
/
FileExploration.cpp
File metadata and controls
64 lines (61 loc) · 1.07 KB
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
#include"headers.h"
void ExploreFileUpwards()
{
struct stat stats;
string t = dir_ent[curr_x-1];
stat(t.c_str(),&stats);
if(S_ISDIR(stats.st_mode))
{
ExploreDirectory(t.c_str());
}
else
{
if (stat(t.c_str(), &stats) == 0)
{
PrintFileProperties(stats);
}
else
{
printf("Unable to get file properties.\n");
printf("Please check whether '%s' file exists.\n",t.c_str());
}
cout<<"\npress any key to continue...";
getchar();
clrscr();
}
curr_x=1;
gotoxy(curr_x,1);
struct stat info;
for(int i=0;i<tot_file;i++)
{
string t = dir_ent[i];
stat(t.c_str(),&info);
if(S_ISDIR(info.st_mode))
{
cout<<GREEN<<t<<RESET<<endl;
}
else
{
cout<<RED<<t<<RESET<<endl;
}
}
curr_x=1;
gotoxy(curr_x,1);
}
void ExploreFileDownwards()
{
clrscr();
string str=root;
str=str.substr(0,str.find_last_of("//"));
str=str.substr(0,str.find_last_of("//"));
if(str.empty())
{
ExploreDirectory("/");
}
else
{
ExploreDirectory(str.c_str());
}
curr_x=1;
gotoxy(curr_x,1);
}