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/