File size: 430 Bytes
0213a4c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
import os
import shutil
def remove_dirs_except_tar(root_dir):
for item in os.listdir(root_dir):
item_path = os.path.join(root_dir, item)
if os.path.isdir(item_path):
shutil.rmtree(item_path)
elif item.endswith('.tar'):
continue
if __name__ == "__main__":
root_directory = '/media/data/CC3M/data/openimages_v7/openimages_v7_valid'
remove_dirs_except_tar(root_directory) |