简体   繁体   中英

How to delete multiple images from firebase storage at a time in android studio

I'm using android studio with firebase, Is there a way to delete multiple images at a time from firebase storage for android

There is no API for bulk or batch deleting files in Cloud Storage. You will have to delete each one individually as described in the documentation .

In one of my project I used below code to delete multiple files

  const imageURLS = !Array.isArray(item?.data?.imageURL)
    ? [item?.data?.imageURL]
    : item?.data?.imageURL;

  imageURLS.forEach(async (URL) => {
    let storageRef = projectStorage.refFromURL(URL);
    await deleteFile(`images/${currentUser.uid}/${storageRef.name}`);
  });

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM