title: Back up and restore a Core Data SQLite (core data)
body: <p>I have searched everywhere on SO Google etc and I can't seem to find a  solution or tutorial that fits for manually backing up, and restoring my Core Data Sqlite files.  The aim is for the user to manually restore the Core Data SQlite files from the documents directory.   </p>
  
  <p><a href="http://ossh.com.au/design-and-technology/software-development/sample-library-style-ios-core-data-app-with-icloud-integration/sample-apps-explanations/backup-files/" rel="nofollow">This seems promising</a> but is just to complex for my needs or to extrapulate the relevant sections to my issue.  I just want to replicate want iCloud does by backing up the documents directory without the user having to restore the device to a back up every time they may need their data back.  I was hoping cloudkit in iOS 8 would make this simpler but nothing has clicked so far. </p>
  
  <p>To summarise: How do I get the contents of the documents directory up to iCloud, then retrieve it again.  Im not after syncing, just remote storage and retrieval of the documents directory. Ive read some people have had success with Dropbox for this, open to that to</p>
  
  <p><strong>UPDATE</strong></p>
  
  <pre><code>NSString *filePath = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:@"app.sqlite"];
          NSString *filePath2 = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:@"app.sqlite-shm"];
          NSString *filePath3 = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:@"iCertifi.sqlite-wal"];
  
  //Path to documents directory
          NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
          NSString *documentsDirectory = [paths objectAtIndex:0];
          NSString *archivePath = [documentsDirectory stringByAppendingString:@"/files.zip"];
  
          //Zip up documents directory
          ZipArchive *archiver = [[ZipArchive alloc] init];
          [archiver CreateZipFile2:archivePath];
          [archiver addFileToZip:filePath newname:@"backUp.sqlite"]; 
          [archiver addFileToZip:filePath2 newname:@"backUp.sqlite-shm"];
          [archiver addFileToZip:filePath3 newname:@"backUp.sqlite-wal"]; 
  </code></pre>