When I update my iOS app, I want to delete any existing sqlite databases in the Documents directory. Right now, on an application update, I copy the database from the bundle to the documents directory and name it by appending the bundle version. So, on the update, I also want to delete any old versions that might exist.
I just want to be able to delete all sqlite files, without having to loop through and look for ones from previous versions. Is there any way to wildcard the removeFileAtPath: method?
So, you’d like to delete all
*.sqlitefiles? There is no way to avoid looping, but you can limit it by using aNSPredicateto filter out non-sql files first and ensure speedy performance using fast enumeration. Here’s a method to do it: