# Rescuing Future Folk from my iPhone

I think Dropbox has corrupted a bunch of my files. I don’t care enough to verify the culprit, but this only happened under ~/Dropbox and not under my iCloud, Google Drive, or local directories. I went to investigate, restore from backup, and otherwise replace. But, I find some of my favorite music is borked.

My first hint of a problem, months ago, was many corrupted PDFs or images. They looked normal and had the expected file size, but the contents were all null bytes. Most of these weren’t a problem because I could get them from backups, email, or their original source. I figured it was a fluke.

As an aside, I’ve noticed that a couple of my banks no longer have the complete history of statements. I don’t really need my statements from 2003, but when did they stop giving me complete records? And, since they won’t email the statements or give me an API to download them, I’m not going to check every month. I guess I’ll do it all at tax time. Get the previous 12 months so Dropbox has more to corrupt.

If I discovered this within 30 days of Dropbox having the good version, I could restore it. I haven’t looked at some of these files for years, though.

Tonight I had some time to survey the damage. I’ll go through all the files and look for those of non-zero size that have something other than a null byte. I’ll use memory-mapping so I don’t need to read most of the file—most of the files are going to fail this test and I want them to fail fast. Otherwise, I’ll output the names that are all nulls:

And, after about 10 minutes and lots of output:

The list isn’t just PDFs or images. Several git repos are corrupted, often because .git/config is corrupted. Many of those I have stored all over the place, including their origin, GitHub (usually origin though), Bitbucket, and GitLab all at once. Those I simply delete locally or re-clone.

I was able to recover some files from another machine connected to the same Dropbox account. That’s odd too; why are they good on one machine but not another? That wasn’t universally true though. Many files were missing on the other machine.

But, the really painful piece of the problem was the disappearance of my Future Folk music.

They sell only one album on Amazon, but they sell both on Apple Music. I thought about buying CDs, then realized that I don’t have a CD player to I could re-rip the songs (do kids today even know “ripping”?) I’m not sure when these files were corrupted, but I listen to these guys while cleaning the kitchen (and how is that possible if they are corrupted files)?

I was momentarily relieved when I realized this some of the rare music I download from the cloud. There’s that little icon next to the album and songs:

But, true to Apple Music’s track record, I can’t re-download it all. I get one of two error messages:

I tried Apple Match when it debuted, but it was a disaster. It mislabeled large parts of my library—all the Led Zeppelin songs were moved to different albums. See Jim Dalrymple’s Apple Music is a nightmare and I’m done with it for the basic idea. I unfucked this in fits and starts over several years, but only after I stopped using Apple Match.

All of this was messed up on my laptop. What about on my phone? I check; the music is fine there! That raises the question that how is this syncing if the source is corrupt, but I also think that’s part of the problem. The files have their meta-data and size preserved. It’s just bad data of the same expected size. Who knows?

The trick is to get it off my phone, and I found an app for that. iExplorer. It can mount my phone so that I can get to the files stored there. Easy peasy. I can transfer files from my phone to my laptop. (I have also tried ifuse to varying degrees of success, but it was such a painful process that I avoid that).

I extracted the .m4a files I needed, and they weren’t protected. I don’t recall if they ever were. I decided to convert them to .mp3 just in case. It’s a short shell loop to batch mode the ffmpeg conversion. That \${f%.*} is a nifty bit of shell expansion to modify the filename:

Now I have non-Apple protected versions of the music I think that Dropbox corrupted and Apple Music wouldn’t download.