Google Earth Engine中没有资产管理界面,资产只能一项一项删除。如何快速删除一批资产?
import ee
ee.Initialize()
asset_list_path = {'id': 'projects/Your/assets'}
asset_list = ee.data.getList(asset_list_path)
print("Asset list:")
for asset in asset_list:
print(asset['id'])
#Define a list of assets to delete (indices 0 to 18).
assets_to_delete = asset_list[0:19]
for asset in assets_to_delete:
asset_path = asset['id']
try:
ee.data.deleteAsset(asset_path)
print("Asset deleted:", asset_path)
except Exception as e:
print("Failed to delete asset:", asset_path)
print("Error:", e)