In [1]:
import os
import shutil

In [2]:
os.makedirs('temp/dir/', exist_ok=True)

In [3]:
with open('file.txt', 'w') as f:
    f.write('')

In [4]:
print(os.listdir('temp/'))


['dir', 'test.txt']

In [5]:
target_dir = 'temp'

In [6]:
shutil.rmtree(target_dir)
os.mkdir(target_dir)

In [7]:
print(os.listdir('temp/'))


[]