One-stop-till-you-drop / file_manipulation.py
Sharathhebbar24's picture
Create file_manipulation.py
1b98c5d
raw
history blame contribute delete
260 Bytes
import os
def remove_files(dirs):
for f in os.listdir(dirs):
os.remove(os.path.join(dirs, f))
def make_directory_if_not_exists(dir_name):
if not os.path.exists(dir_name):
os.mkdir(dir_name)
else:
remove_files(dir_name)