File not completely deleted


#1
 const file = fileSystemModule.File.fromPath(f[k]);
 file.remove().then((res) => {
        console.log(res);
  }).catch((err) => {
        console.log(err.stack);
  });

When I use this code the file get partially deleted. The file cannot open if you try to open it in the gallery but it does not get removed out of the gallery. Can anyone offer some help?


#2

There can be 2 reasons,

  1. Somehow you are trying to access the file again after deleting it, so it creates an empty file.
  2. You might have to delete the entry from Android’s Media Store.

#3

Ok, thank you for your response. Can you say how do I delete the entry from the android media store?


#4

Use scanFile with your folder path.

Refer this doc to know how to convert this to JS / TS.


#5

Thank you again. I really appreciate your help.