os.rmdir is not working in python if it has files. code example Example: python dlete folder import shutil shutil.rmtree('/folder_name')