Deleting a non-empty directory

Discussion in 'Mac Programming' started by swimlikehell, Apr 15, 2008.

  1. macrumors member

    Joined:
    Aug 31, 2006
    #1
    Hello,

    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.
     
  2. Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
  3. thread starter macrumors member

    Joined:
    Aug 31, 2006
    #3
    Yes I am, but I can use cocoa if you know how to do it with that.
     
  4. Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #4
    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:

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

Share This Page