How to replace an already downloaded file?

Hello community,

I have a Download component in my screen, I want to download a file from a cloud and then store its name in TinyDB. But due to many tests, a new download file with the same name gets added to the internal storage with Suffixes:
NewFile-1.mp3,
NewFile-2.mp3

I have set the Download.SaveFileAs to NewFile.mp3

But the ‘Download.DownloadComplete’ gives the file name something like NewFile-12.mp3

How do I replace the existing file?

Thank you,
Tanmay

Your app is trying to be helpful by not overwriting the old file. To get around this, you’d need to add a step where your app checks for ‘NewFile.mp3’ and deletes it before you download the new one. Make sure your app has permission to manage the files, though!

If your setup doesn’t automatically delete files, you might need to either manually remove the old one or change the name of the new file once it’s downloaded and then get rid of the old file.

Thank you so much for replying. Sorry for the late reply, I was trying to test the new detect existing system in my app. But for 3 days, Kodular’s build server has been ‘busy’.
I don’t know when I’ll be able to test the new method.

The solution was, I used the Taifun Files Extension to check if the file already exists. But it failed when I used the legacy ‘File’ component to check.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.