简体   繁体   中英

How to read a file system using Spring

What I need: I need a method that, given a specific directory name on my app, will return his content.

/root
    /folder1
        /folder11
        /folder12
    /folder2
        /folder21
        /file21.txt
    /folder3
        /file31.txt
        /file32.txt

For example, if I call myMethod("/root"); it will return to me a certain object list containing {'folder1', 'folder2', 'folder3'} . Calling myMethod("/root/folder2"); will return {'folder21', 'file21.txt'}

Question: how can I implement this kind of function using Spring?

如果它是目录,则可以使用java.io.File ,并使用docx.list()列出docx.list() ,然后递归地对所有目录子目录执行此操作

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