简体   繁体   English

如何在Liferay 6.2中下载所有文件夹内容

[英]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 ? 有什么方法可以下载文件夹:Liferay 6.2中该文件夹及其子文件夹中的所有文件,而无需循环浏览该文件夹中现有的所有文件?

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. 选择下载XFolder时,系统会在文档和媒体中搜索文件夹,并将所有文件夹内容保存在磁盘的.zip文件中。
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. 您可以尝试使用文件夹和条目的“ treePath”值来找出文件,但是仍然需要进行一些循环。

You will probably need dynamic queries for this. 为此,您可能需要动态查询。

the algorithm should go something like this. 该算法应该是这样的。

  1. Find out ID of your folder 找出您的文件夹的ID
  2. Look through the treePath property of the Folder table and get a list of all paths that you are interested in. 浏览Folder表的treePath属性,并获取您感兴趣的所有路径的列表。
  3. get all folder ids 获取所有文件夹ID
  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) (也许您也可以执行一次查询以收集所有查询)

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

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