Sharathhebbar24
commited on
Commit
•
1b98c5d
1
Parent(s):
a33f703
Create file_manipulation.py
Browse files- file_manipulation.py +14 -0
file_manipulation.py
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
|
3 |
+
|
4 |
+
def remove_files(dirs):
|
5 |
+
for f in os.listdir(dirs):
|
6 |
+
os.remove(os.path.join(dirs, f))
|
7 |
+
|
8 |
+
|
9 |
+
def make_directory_if_not_exists(dir_name):
|
10 |
+
if not os.path.exists(dir_name):
|
11 |
+
os.mkdir(dir_name)
|
12 |
+
else:
|
13 |
+
remove_files(dir_name)
|
14 |
+
|