문제

I searched the web for a solution, but it seems that there is no easy one. Now, there must be a way of course, even if that means that I need to send the RMDIR command to the ftp myself. However my sockets/streams knowledge is not very wide and I'm not sure where should I start.

PS: Already tried CFURLDestroyResource which doesn't work for folder deletion. Apple states that CFNetwork doesn't directly support deletion for FTP scheme/protocol (only for HTTP) so I guess I have to somehow implement it myself, but again, where should I start?

도움이 되었습니까?

해결책

First of all, CFURLDestroyResource works. The problem is, in order to delete a directory , in ftp protocol, the directory should be empty.

So basically you need to enumerate all files & directories in that directory and delete them first.

Also be careful, your URL should end with "/" if you are deleting a directory.

instead of ftp://user:pass@example.com/somedir you should use ftp://user:pass@example.com/somedir/

다른 팁

This open-source project supports FTP in Cocoa; however it appears it might require some hacking to make it work for Cocoa Touch.

Regardless of whether you can use it as is, the FTP protocol implementation therein may help get you on your way.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top