reni
reni

Reputation: 23

Delete folder on server by FTP Connection

I am learning about networking with iOS.

How can I delete a folder on a remote server that I have connected through via FTP?

I tried use CFURLDestroyResource function but it failed. It only deletes files.

I have tried this code :

NSURL * url;
SInt32 status = 0;
url = [[NSURL alloc] initWithString:@"ftp://sikmac3:remuz@localhost/TestFolder"];
CFURLRef urlRef; 
urlRef = (CFURLRef) url;

Boolean test = CFURLDestroyResource(urlRef, &status);
if(test){ NSLog(@"deletion success"); }else{ NSLog(@"deletion failed"); }

Upvotes: 1

Views: 958

Answers (1)

oracle
oracle

Reputation: 11

Your code works for me.

Try with this:

url= [[NSURL alloc] initWithString:@"ftp://sikmac3:remuz@localhost/TestFolder/"];
                                                                             ^

File and folder is a almost same, but add a / at the end of folders.
That's all.

Upvotes: 1

Related Questions