简体   繁体   English

android将文件夹从资产复制到内部设备应用程序数据文件夹

[英]android copy folders from assets to internal device app data folder

I created two folders inside assets ("images" and "files") both containing some files. 我在资产(“图像”和“文件”)中创建了两个文件夹,其中都包含一些文件。 I need to copy it when first launch to data/data/com.relatedPackage.myApp keeping same name and same file contents. 首次启动时,我需要将其复制到data / data / com.relatedPackage.myApp,并保持相同的名称和相同的文件内容。 I am an iOS programmer and that os does not allow to copy whole folders so, in android, which is the proper method to do it? 我是一名iOS程序员,并且os不允许复制整个文件夹,因此在android中,哪种方法合适?

Possible to copy whole folder "images" (including its files) from assets to data/...? 可以将整个文件夹“图像”(包括其文件)从资产复制到数据/ ...吗? That would be great. 那很好啊。 If not, should I create first empty folders using same names at data/... and then copy files from assets to current? 如果没有,我是否应该先在data / ...处使用相同的名称创建空文件夹,然后将文件从资产复制到当前文件? In this case would be necessary to list all files inside folders in order to copy to data/...? 在这种情况下,必须列出文件夹中的所有文件才能复制到数据/ ...? Thank you. 谢谢。

您可以复制zip文件夹,然后将其解压缩

You need to first make sure the folders exist, and if not create them. 您首先需要确保文件夹存在,如果没有,请创建它们。 After that you need to copy the files individually by enumerating what files need copying. 之后,您需要通过枚举需要复制的文件来分别复制文件。 I'm not aware of any way to do this in bulk. 我不知道有任何方法可以批量进行此操作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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