简体   繁体   中英

Android - FTP Upload Directory

I'm trying to upload all directories and files that exist into a path. I'm using the below code to get the directories:

String path = Environment.getExternalStorageDirectory().getPath() + "/Vistoria/";
   File f = new File (path);
   File file[] = f.listFiles();

   for (int i = 0; i < file.length; i++) {
       Log.e("File " + i + ":", file[i].toString());
   }

Is it possible to upload them direct? Or I need to go into each of the directories and upload the files?

Thank you

Even if there is a library that handles full directory upload, inside it will list the internal directories recursively and start uploading files, so upload the files.
BTW, it's recommended to use the following constructor to create a sub-folder from a parent folder, instead of hand coding the path youself

File f = new File(Environment.getExternalStorageDirectory(), "Vistoria");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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