Re: Recursive file remove
Re: Recursive file remove
- Subject: Re: Recursive file remove
- From: Charles Srstka <email@hidden>
- Date: Sat, 14 Aug 2010 22:37:34 -0500
On Aug 14, 2010, at 10:14 PM, mark wrote:
>> As noted, your choices are either NSFileManager methods of BSD/POSIX functions. I would tend to start with the latter because, at the end of the week, NSFileManager might not have the configurability you need to handle the nitty-gritty like system "dot" or "dot dot" files, (not) following symbolic links, etc. etc. But it may be just a personal preference. NSFileManager has not always been my friend.
> <snip>
>
> What's wrong with FSDeleteObjec()? (Core Services File Manager).
> You need to do a lot of recursive stuff using to empty directories bottom up.
FSDeleteObject is not recursive and requires you to iterate through the entire subtree just like unlink, requires you to get an FSRef (which you’ll usually not be working with in a Cocoa app), and fails if Spotlight happens to be indexing a file or an anti-virus app is scanning it (as per Technical Q&A QA1497).
However, this is not the most cumbersome possible solution, and therefore not good enough. Obviously what you *really* want to do is dismount the volume, open the character device, parse the HFS+ volume structures, and manually delete the items out of the catalog file.
Charles_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden