Re: Deleting 20000 files in applicationWillTerminate
Re: Deleting 20000 files in applicationWillTerminate
- Subject: Re: Deleting 20000 files in applicationWillTerminate
- From: Roland King <email@hidden>
- Date: Sat, 16 Nov 2013 08:37:46 +0800
On 16 Nov, 2013, at 8:18 am, Jens Alfke <email@hidden> wrote:
>
>
> As for the deletion, I don’t know how long deleting 20,000 files will take; you’d need to experiment. The OS only gives your process a limited amount of time to respond to the enter-background (or terminate) notification before killing the process, but I don’t know exactly how long that is.
>
If you put all the files in a subdirectory and delete the subdirectory, I've found that to be pretty quick. You can also set up a background task which gets a reasonable amount of time to complete, plenty enough to delete files.
Don't forget, your app could just be killed at any point during this, so when you restart, check your flag to see if the user asked for deltes, if it was set then make sure the files were actually deleted, or delete them at that point.
_______________________________________________
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