cat rm.py
#!/usr/bin/python3
# coding=utf-8
# */12 * * * * /usr/bin/python3 /data/mon/rm.py
import os
import shutil
mypath = '/data/backup/'
#os.removedirs(path) #空目录才行
shutil.rmtree(mypath)
os.mkdir(mypath)
# os.mkdir(path, mode=0o777, *, dir_fd=None)
see also
python3 删除 文件 文件夹
Python Create Directory – mkdir()