简体   繁体   中英

How to download all folder content in Liferay 6.2

Is there any way to download a folder : all files within the folder and subfolders in Liferay 6.2 without using a loop through all files existing in the folder ?

I need to do it programmatically.

Example : 
Folder to download "XFolder"

XFolder
 - SubFolder1
   - File11
   - File12
 - SubFolder2
   - File21
   - File22
 - File1
 - File2

When choosing to download XFolder, the system searches the folder in document and media and saves all the folder content in a .zip file in disk.
The content should have the same structure above.

Thank you for your help.

You can try to use the "treePath" value of folder and entry to figure out the files but you still will require some looping.

You will probably need dynamic queries for this.

the algorithm should go something like this.

  1. Find out ID of your folder
  2. Look through the treePath property of the Folder table and get a list of all paths that you are interested in.
  3. get all folder ids
  4. loop through all the folders that you are interested in and load their respective files. (Probably you could also do a query that would collect it all in one go)

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