java - How to download all folders and files from dropbox using CoreAPI -
i'm integrating dropbox program, downloading folders, subfolders, , files within folders becoming hassle figure out. know how list folders , files root directory , download each individually using below code:
dbxentry.withchildren listing = null; try { listing = client.getmetadatawithchildren("/"); } catch (dbxexception e1) { e1.printstacktrace(); } however, how go downloading folder within folder user had specified? program creates interface similar dropbox android app interface, , the metadata folders , file downloaded , saved upon clicking. i'm having issue creating correct path. how go doing this?
this problem encountered 1 of projects.
you have start can list files, add on need simple each loop. should this: note: files
(dbxentry child : listing.children){ mclient.getfile("/pathtofile/" + child.name, null, new fileoutputstream(filepath + mpathsep + child.name)); } in order folders, suggest modifying above code adding if statements. dbxentry has isfile/folder method can use determine if file. once hits file can new
(dbxentry child : listing.children){ if(child.isfile()) mclient.getfile("/pathtofile/" + child.name, null, new fileoutputstream("pathtonewfile" + child.name)); else new file(path).mkdir(); } with information, can achieve end goal.
Comments
Post a Comment