View Full Version : Deleting a non-empty directory

Apr 15, 2008, 10:11 AM

I am trying to create some code that will delete a non-empty directory so that a user can replace an application in a specific folder on their computer. I have tried using FSDeleteObject but that only would on empty directories. Any help would be much appreciated, thanks.

Apr 15, 2008, 10:17 AM
You're using Carbon right?

Apr 15, 2008, 10:24 AM
Yes I am, but I can use cocoa if you know how to do it with that.

Apr 15, 2008, 10:28 AM
I tried looking for a Carbon solution but couldn't find anything. I'm sure there is some code snippet out there though. You could also just try using standard POSIX functions.

But in Cocoa it's as simple as:

[[NSFileManager defaultManager] removeFileAtPath:somePath handler:nil];