Backing up your iTunes / iPhone / iPad universe on Windows 7

Although I've never owned a Mac, I'm about as deep into the iUniverse as one can get. My entire life is crammed into this iPhone and has been for nearing 4 years now. I'm not the only one in this situation. Losing the device isn't that big of a deal since you can go buy another one, plug it into iTunes and drop the last backup of your life on it without skipping a beat. But what happens when your computer goes up in flames? Or what if you switch computers? You want to be able to get iTunes back up and running exactly as you left it, complete with all the apps, iPhone & iPad backups, playlists, and music libraries. Unfortunately, Apple has chosen to make the back-end happenings quite complicated. The following is what I've figured out from snooping around my machine and from the intarwebs and how to automate the process of backing all of this up.

Before we get started, note that this post applies to Windows 7 and iTunes Future versions of iTunes may not be organized the same way, and could ruin Christmas. Previous versions of iTunes and Windows may have the same difficulties. I'll try to keep up with changes to iTunes in future posts.

Couldn't care less about what these files are and just want the backup script? Fine, here it is. Your browser may interpret it as just a text file (Chrome did). Save it as such, then change the extension to .bat to make it executable. Replace 'Kevin' with your Windows 7 user name and 'Z:\iTunes_Backup' with a backup directory of your choice. I do recommended you read on though...

Backing up the iTunes folder in your user directory

There are two important files located here: C:\Users\UserName\Music\iTunes\
Apple explains what they do here, but I'll regurgitate it here as well. (Interesting note: That knowledge base page I linked to shows the files as 'iTunes Library' but mine are named 'iTunes Music Library'.)

iTunes Music Library.xml. - This file is pretty long (mine was 104,373 lines long!) and contains all sorts of information about the tracks, like where they live, play counts, etc. Other applications use this file, but it looks like only iLife-related ones care. This is more important on Mac OS.

iTunes Music Library.itl - This is the important one! It's a database that contains song-specific data like ratings and comments. Most importantly, it contains your playlists. Sadly, it's not something that's human readable. We want to hang on to this one.

If you've never changed your iTunes media folder, it lives here and is aptly named 'iTunes Media'. We'll discuss that folder later.

What else is in this folder? In my installation, it looks like the rest of the stuff here is a graveyard of old files and apps from iTunes-es of yesteryear. It's better to be safe than sorry, so I back up the entire business.

Backing up iTunes local application data

The next folder we want to hang on to is: C:\Users\UserName\AppData\Local\Apple Computer\iTunes
iPodDevices.xml looks like it keeps track of what devices iTunes has found in the past.
Not going to lie to you, I have no idea what the rest of these files are for. The only reason I recommend hanging on to them is because the timestamp is always recent on them, so iTunes is actively using them. 

Backing up iTunes roaming application data

Hang on to this guy: C:\Users\UserName\AppData\Roaming\Apple Computer\iTunes

There are several more files and folders in this directory, but again I'm not too sure what they're for. We'll keep them though. 

Also, this guy: C:\Users\UserName\AppData\Roaming\Apple Computer\MobileSync

This is where your iPhone and iPad backups live. They're named incoherently, but these are the backups you choose from in iTunes when restoring from an old image of your device. There should be a few gigs of data here.

Let's also hang on to these other folders since they seem to also be related:
C:\Users\UserName\AppData\Roaming\Apple Computer\SyncServices
C:\Users\UserName\AppData\Roaming\Apple Computer\Preferences
C:\Users\UserName\AppData\Roaming\Apple Computer\Logs

Backing up Music, Video, Books, Apps, and everything else

Find your iTunes media folder location by opening up iTunes, then selecting 'Edit' - 'Preferences' - 'Advanced' (tab). iTunes defaults to C:\Users\UserName\Music\iTunes\iTunes Media

This is where iTunes keeps your apps, downloaded music, videos, podcasts, movies, TV shows, books, etc. That said, this is a pretty important directory. I don't recommend keeping it in the default location; instead I'd rather see it on a separate hard drive so it's not tied into your user account and with the rest of the OS. As a rule I always keep data separate from the operating system drive in case it goes down. Since we're backing this stuff up, it may be a moot point, but a good practice nonetheless. 

Backing up pictures and videos taken on your iPhone

Unfortunately, I haven't figured out how to automate this part yet. When Windows finds your phone after you've plugged it in, it shows up in Windows Explorer and you can manually copy those files out of it.

Automating this process with a script

I use a script to back up my data, and you can download it here. Unless you happen to be me, you'll need to change it slightly.
  1. Change all instances of 'Kevin' to whatever your Windows 7 user name is. If you're name is Kevin, you just saved yourself nearly 8 seconds of work.
  2. Change all instances of 'Y:\iTunes_Backup' to the path where you want to back all this stuff up to. 
  3. Change 'J:\iTunes' to your iTunes media directory. If you keep it in the default location, C:\Users\UserName\Music\iTunes\, you can comment this line out since it will be included in the first robocopy command. Add two colons '::' to the beginning of the line to comment it out.
  4. Don't be alarmed when launching this script opens a command prompt; people get scared of DOS-looking things. Nothing shady is going on, with the exception of sending your bank account and credit card information to Wikileaks. 
Every time I sync my phone, download music, or do anything else iTunes related, I always launch the script after I close the application. It just takes a second to kick off, then you can walk away and let it do its thing. Just make sure you close iTunes before you run it. Putting an icon on your desktop helps too. 

Recovering from a disaster with your backup

Simply install the latest version of iTunes, copy your backup files to their original locations, and pray that this version of iTunes hasn't changed where it wants to see these things. Since we kept the folder structure the same in the backup as it is in your user directory, you can simply copy all of the backup data from its safe haven into your user directory once you get your computer fixed/installed/revived/etc. If you are able to maintain the same paths that you had before, when you open up iTunes after restoring all of these files, everything will be exactly as you left it. If the path to your iTunes media folder has changed, you'll have to create a new library and the associated playlists, comments, ratings, etc will be wiped out. Bummer aye? That's iTunes for ya. Hey, at least you've got your iPhone backups, right?

Hit up the comments below this post if you have any questions or corrections.

Thoughts on 'Thoughts on Flash'

Running in the cool night air, dodging puddles accumulated from the recently passed thunderstorm, a man's mind turns to Flash. Well, maybe not, but Nilay and Josh did have a really good debate on this weeks Engadget podcast about Flash that got me thinking about it again. The topic even got into mainstream news recently, appearing on the front page of , so this issue is even more out in the open than ever.

If you don't know what all the fuss is about, let me briefly break it down. Adobe, the software company that makes Photoshop and all sorts of other popular graphic arts tools, owns a multimedia platform known as Adobe Flash (or just Flash if you're one of the cool kids). Flash is everywhere on the internet, and I mean everywhere. According to a few studies, Adobe's Flash Player is installed on over 98% of internet-connected computers and devices. You are bombarded with Flash constantly, whether you realize it or not. Pop the baloon and win a free iPod? That ridiculous animated ad is probably on Flash. Watching a video on Hulu? All the video uses Flash. Checking out The entire site is Flash based. There is so much Flash content out there that you can even install Flash-blocking plug-ins for your web browser. Flash is all over, and there's no getting around it.

Well, then the iPhone showed up. Navigate to a site with flash on it, and you're greeted either with a blue lego (alerting you of a missing component, get it?), a gaping hole of nothing-ness in the middle of the page, or a seemingly helpful message directing you to go install Flash. Hulu is nice about it:

Hulu sadness on iPhone

At least here you know that there's something you're missing. Recently, the sad blue lego that used to appear in place of the content you were missing a plug-in for no longer appears. So, when you're reading Engadget's review of Microsoft's Kin devices on your iPad, you come across a section that looks like the screen capture below on the left. From a desktop, on Google's Chrome browser, you see what you're actually missing (below right).


                        Kin review on iPad                                                 Kin review on Chrome

iPhone OS does not support flash, meaning the iPhone, iPod Touch, and iPad can't rock Flash content, and Apple recently made it clear that it does not intend to implement it in the future. Adobe is obviously not happy about it, just read any of their press releases or interviews on the subject. Heck, they've even got a passive aggressive message waiting for you when you try to install Flash player for your device.

If you haven't read Job's open letter on why Apple has decided to forgo Flash, you should definitely check it out. This is what I will be to talking about in this post. 

When you sit down at a computer, you surf the web, and you just expect everything to work. If you go to a website and there's a gaping hole where Flash content should be, you have a right to get angry. Now, if you're on your smartphone, say an iPhone, and you navigate to a Flash-based page, you might be able to make peace with the fact that you can't get at all content since this is still just a phone. This is a much tougher sell with the iPad. Steve Job's is famously quoted as declaring the iPad has "the best web browsing experience you've ever had", even as he scrolled past sad looking Flash-holes in web sites. Why would Apple leave out such a popular and, in many cases, critical component of the web from their devices? All the answers are in Job's open letter on the subject. Here's my take on it.

I believe that the underlying reason for most of the points in the letter is the fabled Apple experience. Ask anyone about Apple computers and invariably they will come back with "they don't crash", "they just work", or they're "really easy to use". Same with the iPhone, and now with the iPad. Don't believe it? Ask this little lady. Apple sells an experience, and at a premium. You pay the 'Apple tax' for the experience, an experience that is only possible because of the extremely closed nature of their hardware and software. If people pick up an iPhone and the web browser is crashing all the time because of the Flash-filled websites, that takes away from this aura that Apple has tried to surround their devices with. Combine this with the additional drain on your battery as the processor feverishly decodes the video, and you have an even worse experience. 

Now, this is not to say that I think these downsides are all that big of a deal. The browser, Safari, crashes on me all the time anyway. And there is no way in hell that I could possibly get two full days of charge out of this thing to begin with. After a full night's charge, I've got about a 30-40% charge at the end of the following day. It's quite a bummer when you navigate to a page you're interested in and all the good stuff is in Flash, and thus completely blank. You get used to it after a while, come to expect it, and move on.

I could definitely tolerate some degradation of the iPhone/iPad experience to have Flash thrown in the mix, but I'm not sure that I can blame Apple for keeping it out of their 'walled garden'. They're the phone to beat in the mobile world, and have the first successful tablet on the market. Nobody got these devices anywhere near close to being right until they came along. Apple dominates the market with these devices, and has enough weight to shape the future. If they want Flash out, it might be hard to stop them with the current rate of adoption of their products. And since Flash is such a resource hog, that part isn't even up for debate, I think that the end result will be faster adoption of HTML5 than would be possible otherwise. 

Adobe had a lame response to Job's letter because ultimately, Jobs was correct on his technical points. However, since today's internet is so heavily entrenched in Flash, iDevice users are not getting the full experience. So now we wait. We wait until everyone switches over to HTML5 or the websites we care about start writing apps (Hulu please!!!). In the mean time, we can be pissed that there's no Flash, just like we were until copy and paste was implemented, and just like we while we waited for the worlds most awesome smartphone to learn how to send a picture message. Eventually this will be a non-issue, but for now, it's the most visible and restrictive issue with iPhone OS. 

There is another major point of contention in Job's letter, and it has to do with blocking the use of cross-platform tools that allow app developers to write an app in some other programming language and compile it for iPhone OS. He says the reason for this is that this additional layer of abstraction results in sub-par apps. I'm on board with that, but cross-platform coding is used very widely. Adobe even has support in CS5 for compiling iPhone OS applications, which because of Apple's new legal terms, has been rendered useless. 

This story is still developing, but I think I get why Apple is doing this. They want developers to develop specifically for their platform. They want apps that have been tailored to exactly what the iPhone has to offer, but primarily to have developers putting more effort into iDevices than, say, Android or WebOS. And this could even work! Look at the numbers; there are millions and millions of iPhones and iPads floating around out there. The iTunes store is incredibly successful; Apple's ecosystem rocks. Now that you can't just write one app that you can push on to all the major smartphones, you have to write the same app in two different languages.If you're a developer, you'd be crazy not to go after Apple's customer base. This strategy keeps developers spending more time with Apple and less time with everyone else, plain and simple.

I'm actually getting quite sick of this story, and luckily it looks like some of the major issues will be relieved. Hulu is reportedly working on something that could get their content to these devices, Adobe seems to be whining less about flash and instead announcing HTML5 tools. Moving away from Flash is good for everyone, well maybe not Adobe, but until we get something else it's the consumer who feels the burn. 

In the mean time, thank you ABC for your app that fills the void that a Hulu-less iPad has left in my heart, you've shown everyone that if you want to get your content on iPhone OS, you can just go off and do it.