How do you delete a file in folder Download?


I need to delete icons dowloaded to the Download folder. With the attached block I get error. How do it?

Post a screenshot of it.

Downloaded with the same app? Companion or APK?

Yes is downloaded with the same app (different screen) from site icons8.com and using APK.
The App Default scope is set to Legacy.
Using the block in the figure I have no error message but the icon is not deleted. Using 'Shared' instead of 'Legacy' in the block I get the following error.

Whith the following block I can copy the same icon from Download to ASD folder /ICON.

You cannot delete (overwrite) a file that isn't created by the app itself. So (and this will cause your problem) if the app was first tested with Companion, it will no longer work with the APK because this is a new (different) app. So the file (image) must first be deleted again with Companion before the same process works with the APK.

I never use Companion. The file was created during the download process from site icons8.com.

You could try with this little saf extension (not extensively tested):

uk.co.metricrat.safdelete.aix (4.6 KB)

Use either the activityStarter

or the FilePicker

image

to select the file to be deleted.

This should be able to delete files created by the app, and "foreign" files, not created by the app.

Which download process?

Post the aia (or send it to me via PM).

The .aia is very complex. As I show in preious replay I used this metod:

TextBox1 holds a icon name.

Replying to TIMAI2. I tried your procedure and it works. It lists the contents of the Download for me, I make the choice and it deletes it for me. However, I don't understand where the Download folder is indicated. Also what do you need to indicate in DataType to select only .png files.


I frequently get this error when using .aix. Trying again sometimes works fine.

If using the activityStarter set the datatype to image/png

If using the FilePicker you can use its own blocks to refine the filetype in the same way.

Your 601 error is an activityStarter error, not an error with the extension. Try using the FilePicker instead.

If using the FilePicker, and the user does not select a file, but uses the Back button to return to the app, an error will be shown (4501). To avoid this, drag out this block, and use it as it is.

image

Thanks. I'll try this afternoon.

If this works without READ_MEDIA_IMAGES permission on Android 13+ or without READ_EXTERNAL_STORAGE permission on Android > 10 and < 13, then the file (image) must be created by the app itself. But then the File.Delete method should also work.

Try to delete the image with @Taifun's TaifunFile extension.


I'll check the File.Delete method later with the APK again. But I'm pretty sure that I did this several times and it worked.

I tested with Taifun file extention. The result was the same as file.delete. No errors and no deletions.

The problem could be that from the app I connect to the site mentioned, but then I download the icon from there and perhaps it doesn't consider it created by the app itself.

But as I already said, then it should not be possible to copy this media file (image) without READ permission (on any Android version).

Create a small test app that reproduces this problem and post the aia.

I send you what I could do because I had a little time.
You should press 'Go to Download', type a name of any icon you wish (like moon or sun), and press Download Icon. You will be connected to site icons8 , choose an icon, and download in png format and free. Then come back to app and press refresh list. Should be there. Now you can try to delete it.
TESTICON.aia (11.5 KB)

I don't understand how icons (images) are downloaded there. I tried to test your app briefly (with Companion)... without result...

Nothing is downloaded and nothing appears in the list. The functionality of your app remains unclear, at least for me (but most likely also for the average user).

I think if you try first to do the dowload without the app, connecting to site icons8.com. You will down load an icon. Than you can retry the same from app. The refresh button should show you any png icon is in Dowload.