1import shutil
2
3shutil.rmtree('/folder_name')
4shutil.rmtree('/folder_name', ignore_errors=True) # for read only files
1'''
2 Check if a Directory is empty : Method 1
3'''
4if len(os.listdir('/home/varun/temp') ) == 0:
5 print("Directory is empty")
6else:
7 print("Directory is not empty")