Get all folders of URL

前端 未结 3 465
鱼传尺愫
鱼传尺愫 2020-11-30 14:56

Hi I\'m trying to read all files from a given server. What I want to do:

  • Read all the folders
  • Get the file URLs inside the folders

I tr

相关标签:
3条回答
  • 2020-11-30 15:21

    You can't do this with NSFileManager. NSFileManager is intended to work with your file system (your device's file system) not with server.

    you need to create a server side file which should give you folder/files url in xml file

    0 讨论(0)
  • 2020-11-30 15:21

    So if I understand correctly, you have the list of all the folders in the folder you need to read, but now you need specific files from each folder?

    Then why don't you create a for-loop?

    for (int i = 0; i < [contentlist count]; i++
    {
        //do your trick to get the file in the folder
        //save it
    }
    

    EDIT: If you mean you get the files from your Mac instead of the server you need, then you should change the line contentsOfDirectoryAtURL:directory to something like contentsOfDirectoryAtURL:@"http://localhost/myserver/.

    0 讨论(0)
  • 2020-11-30 15:30

    You can not make use of NSFileManager to access the remote folders. This class is able to access the local directories only.
    If your server supports FTP connection then you can make use of CFFTPStream.
    CFFTPStream Reference

    0 讨论(0)
提交回复
热议问题