forked from profpiyush/Hacktberfest-2021
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDateCount.py
183 lines (138 loc) · 5.07 KB
/
DateCount.py
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
from datetime import date, timedelta
sdate = date(2021, 6, 7) # start date
edate = date(2021, 7, 26) # end date
delta = edate - sdate # as timedelta
count = 0
for i in range(delta.days + 1):
day = sdate + timedelta(days=i)
count += 1
print(day)
print("\nDays: {}".format(count))
ss2402@heatcliff24:~$ cd os_lab
QUES 1.
A) Create the file names under the directories as mentioned in the figure and write some relevant data into the files.
ss2402@heatcliff24:~/os_lab$ mkdir 2005535
ss2402@heatcliff24:~/os_lab$ cd 2005535
ss2402@heatcliff24:~/os_lab/2005535$ mkdir KIIT
ss2402@heatcliff24:~/os_lab/2005535$ cd KIIT
ss2402@heatcliff24:~/os_lab/2005535/KIIT$ mkdir SCE SCIVE SEE SME SETCE
ss2402@heatcliff24:~/os_lab/2005535/KIIT$ cd SCE
ss2402@heatcliff24:~/os_lab/2005535/KIIT/SCE$ mkdir CSE IT CSSE CSCE
ss2402@heatcliff24:~/os_lab/2005535/KIIT/SCE$ cd IT
ss2402@heatcliff24:~/os_lab/2005535/KIIT/SCE/IT$ cat>info.txt
This is a test file for Assignment 1
File name is info.txt
^C
ss2402@heatcliff24:~/os_lab/2005535/KIIT/SCE/IT$ cat>first.c
#include <stdio.h>
void main()
{
printf("First.c file");
}
^C
ss2402@heatcliff24:~/os_lab/2005535/KIIT/SCE/IT$ cd ..
ss2402@heatcliff24:~/os_lab/2005535/KIIT/SCE$ cd ..
ss2402@heatcliff24:~/os_lab/2005535/KIIT$ cd SEE
ss2402@heatcliff24:~/os_lab/2005535/KIIT/SEE$ mkdir M.Tech
ss2402@heatcliff24:~/os_lab/2005535/KIIT/SEE$ cd M.Tech
ss2402@heatcliff24:~/os_lab/2005535/KIIT/SEE/M.Tech$ cat>student
Test file
File name is student
^C
ss2402@heatcliff24:~/os_lab/2005535/KIIT/SEE/M.Tech$ cd ..
ss2402@heatcliff24:~/os_lab/2005535/KIIT/SEE$ cd ..
ss2402@heatcliff24:~/os_lab/2005535/KIIT/SCE$ cd ..
ss2402@heatcliff24:~/os_lab/2005535/KIIT$ cd SETCE
ss2402@heatcliff24:~/os_lab/2005535/KIIT/SETCE$ mkdir ETC CE ECE
ss2402@heatcliff24:~/os_lab/2005535/KIIT/SETCE$ cd ETC
ss2402@heatcliff24:~/os_lab/2005535/KIIT/SETCE/ETC$ mkdir LIBRARY
ss2402@heatcliff24:~/os_lab/2005535/KIIT/SETCE/ETC$ cd ..
ss2402@heatcliff24:~/os_lab/2005535/KIIT/SETCE$ cd ..
B) Rename the file info.txt as itstudentsdata.txt.
ss2402@heatcliff24:~/os_lab/2005535/KIIT$ mv SCE/IT/info.txt SCE/IT/itsstudentdata.txt
ss2402@heatcliff24:~/os_lab/2005535/KIIT$ cat SCE/IT/itsstudentdata.txt
This is a test file for Assignment 1
File name is info.txt
C) Copy the file first.c into the directory CE with the same name.
ss2402@heatcliff24:~/os_lab/2005535/KIIT$ cp SCE/IT/first.c SETCE/CE/
ss2402@heatcliff24:~/os_lab/2005535/KIIT$ cat SETCE/CE/first.c
#include <stdio.h>
void main()
{
printf("First.c file");
}
D) Copy the file first.c into the directory SME with a new name as hello.c.
ss2402@heatcliff24:~/os_lab/2005535/KIIT$ cp SCE/IT/first.c SME/hello.c
ss2402@heatcliff24:~/os_lab/2005535/KIIT$ cat SME/hello.c
#include <stdio.h>
void main()
{
printf("First.c file");
}
E) Transfer the file student into the directory SCIVE and check whether transferred or not.
ss2402@heatcliff24:~/os_lab/2005535/KIIT$ mv SEE/M.Tech/student SCIVE/
ss2402@heatcliff24:~/os_lab/2005535/KIIT$ ls SCIVE
student
ss2402@heatcliff24:~/os_lab/2005535/KIIT$ cat SCIVE/student
Test file
File name is student
F) Rename CSSE to SYSTEM ENGG
ss2402@heatcliff24:~/os_lab/2005535/KIIT$ ls SCE
CSCE CSE CSSE IT
ss2402@heatcliff24:~/os_lab/2005535/KIIT$ mv SCE/CSSE SCE/'SYSTEM ENGG'
ss2402@heatcliff24:~/os_lab/2005535/KIIT$ ls SCE
CSCE CSE IT 'SYSTEM ENGG'
G) Delete ECE directory.
ss2402@heatcliff24:~/os_lab/2005535/KIIT$ rmdir SETCE/ECE
ss2402@heatcliff24:~/os_lab/2005535/KIIT$ ls SETCE/ECE
ls: cannot access 'SETCE/ECE': No such file or directory
ss2402@heatcliff24:~/os_lab/2005535/KIIT$ ls SETCE
CE ETC
H) Delete SEE directory.
ss2402@heatcliff24:~/os_lab/2005535/KIIT$ ls
SCE SCIVE SEE SETCE SME
ss2402@heatcliff24:~/os_lab/2005535/KIIT$ rm -r SEE
ss2402@heatcliff24:~/os_lab/2005535/KIIT$ ls SEE
ls: cannot access 'SEE': No such file or directory
ss2402@heatcliff24:~/os_lab/2005535/KIIT$ ls
SCE SCIVE SETCE SME
I) Copy IT directory to LIBRARY
ss2402@heatcliff24:~/os_lab/2005535/KIIT$ cp -r SCE/IT SETCE/ETC/LIBRARY
ss2402@heatcliff24:~/os_lab/2005535/KIIT$ ls SETCE/ETC/LIBRARY
IT
ss2402@heatcliff24:~/os_lab/2005535/KIIT$ tree SETCE
SETCE
├── CE
│ └── first.c
└── ETC
└── LIBRARY
└── IT
├── first.c
└── itsstudentdata.txt
4 directories, 3 files
Final Directory
ss2402@heatcliff24:~/os_lab/2005535/KIIT$ cd ..
ss2402@heatcliff24:~/os_lab/2005535$ cd ..
ss2402@heatcliff24:~/os_lab$ tree 2005535
2005535
└── KIIT
├── SCE
│ ├── CSCE
│ ├── CSE
│ ├── IT
│ │ ├── first.c
│ │ └── itsstudentdata.txt
│ └── SYSTEM ENGG
├── SCIVE
│ └── student
├── SETCE
│ ├── CE
│ │ └── first.c
│ └── ETC
│ └── LIBRARY
│ └── IT
│ ├── first.c
│ └── itsstudentdata.txt
└── SME
└── hello.c
13 directories, 7 files