Download Multiple Files with subfolders

This path //file/ will never exist.

See also here:

grafik

Does it really work? I don't think so, at least not with the compiled app (APK).

  • The ASD is created automatically on Android β‰₯ 10.
  • You cannot save / copy / download to the assets (//) and as I said this path: //files/ doesn't exist (and will never be created). So remove the .IsDevelopment and if_then_else blocks.
  • And move the join block to the global strPath

grafik

See also here:

Dear Anke,

it worked, but I changed it as you mentioned and Download still works.

However, path to the file looks like this:

BUT, the copy Function is still not working... :frowning:

So the Web component also adds the ASD path (like the File component):

/storage/emulated/0/Android/data/<packageName>/files/

automatically. Try this:

Same, download works (now with the correct path) but copy does not work

I think I know whats wrong:

Screenshot_2

fileName is the complete path , eg --> /storage/emulated/0/Android/data//files/files/file.pdf

so this:

Screenshot_3

Would lead to the following path:

/storage/emulated/0/Android/data//files/files/storage/emulated/0/Android/data//files/files/file.pdf

Am I right?

So what would be the correct blocks?

Yes, the path is correct. But did you get an error message?

What do you get from the .Copied event?
grafik

No, the block / path is correct and should be:

/storage/emulated/0/Android/data/<packageName>/files/files/file.pdf

Screenshot_4

leads to:

Screenshot_5

leads to:

Image2

It looks like the variable "fileName" is not the correct value. It contains the entire path to the file instead of just the filename.

and post the result.

Yes thats right!!

But how do I get only the filename and not the path?

@Anke

Screenshot_1

The question is if this path / file exists. Check that.

This way you will get the file name along with the directory structure.

This did not work, but finally i got it working with this:

Screenshot_1

THANK YOU VERY MUCH @Anke and @Patryk_F

You replace the ASD plus /kundc/ and add this path back in the copy function.
This doesn't make any sense at all. So this would be the way to go:

Explanation

Explanation:

This would not work because I need the "global file" = filename with folder structure also for the CopyAsync funtion (copy toFileName)

Screenshot_2

It should look like this:

Note: As already said, this will no longer be possible when AI2 targets Android 11 (targetSdkVersion = 30 (Aug 2021 or for updates Nov 2021). Only if no further updates have to be made later would it actually be no problem to do it this way..

EDIT: Of course it should be: grafik

1 Like

Do it once and do it neatly according to the art and not according to your ideas. In a few months you will find your application not working and waste a week fixing it again. If you already have files downloaded to ASD, why do you copy them to another directory? Leave them in the ASD and load them into the app from ASD.