I’m working on an important project for a client at the moment, and had a bunch of annotated files saved to iCloud’s Documents in the Cloud feature from the excellent PDF Pen app, which I use on both the iPad and my Macs.
I had manually deleted a few unrelated files, and when I returned to the app on iPad, all my files were missing. So I checked on my MacBook Air and my iMac, and same story. Gone!
At this point, I had lost a bit of faith in the iCloud promise (which I am otherwise liking), and was certain that the problem was either a software issue (Smile Software’s implementation of iCloud), or with iCloud itself. After calming down, I realised that it was probably user error, but that wasn’t getting my documents back.
I was at a bit of loose end, not knowing whether to call Apple Care, or post to a forum or similar, when I saw the blog post by Chris Breen at MacWorld, When Documents in the Cloud aren’t… Chris had been responding to a reader who had “lost” a document he printed as PDF to iCloud:
In the Finder, hold down the Option key, click on the Go menu, and choose the now-visible Library command. Locate and open the Mobile Documents folder. Within you’ll find multiple folders. In your case you want the com~apple~mail folder. Inside you’ll find a Documents folder. Within it is your PDF file.
Now this didn’t address backups, but it did make think that if there is a local copy in the file system, then my Time Machine backups may well have a copy of my missing documents.
The next problem was that the “Library” folder in Finder is hidden, and while the Option-Click approach above works well for finding current documents, I wasn’t sure how to approach this in Time Machine. A quick visit to Dr Google found the CNet article How to access hidden files to restore in Time Machine.
Unfortunately, if you have removed a hidden directory that is within a normally visible directory (as is the case with the entire /etc directory), then the Finder will not allow you to see it by default, so using the “Go to folder” command will not work. Nevertheless you can still restore it using Time Machine by first showing hidden files in the Finder.
To show the hidden files, simply open Terminal, and enter this command :
defaults write com.apple.finder AppleShowAllFiles TRUE;killall Finder
Once you’ve done this, enter Time Machine as usual, browse to the dates you’re looking for, and go to the Library>Mobile Documents folder, and you’ll see a list of folders for iCloud Documents, sorted by app. Find the right folder, and you should see the files in the iCloud for that App on that Date. Select and Restore, and you should be good to go.
Its kind of nice when things work out! Everything I needed was there, I just had to do some digging. Given that its more than possible that other users will make silly errors like mine, I wonder when Apple will make this type of restoration more seamless. Whilst its easy to use the Revert To function to go back to previous versions of a file within a given app, it doesn’t help if you’ve deleted the whole file. In the meantime, I hope this workaround works for others.
 The excellent TotalFinder application provides many extensions to your OSX Finder, including the ability to easily “Show System Files”, restoring access to the Library and and other hidden files.