Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I find that iTunes management of backing up Apps isn't ideal for a number of reasons. It will happily keep a copy of the most recent App in it's own area within the iTunes library, but it's archival process is very much against your "current" applications, without necessarily keeping a history of previous versions.

There are various reasons for keeping previous versions of an App, from being able to simply revert when a new version is buggy or makes changes which you do not wish to use, to the App changing it's minimum requirements to need hardware which you just down own therefore making the App unusable.

My current manner of archiving old iOS applications is both manual and therefore dysfunctional.

Currently I move copies by hand to a folder named "old iOS applications". I also depend on Time Machine to provide historical copies of apps for the rare case when an update to an app causes me to have a problem with functionality of an app. I prefer to keep iTunes only managing apps that are actively installed by deleting things I don't use regularly and letting the next iOS sync transfer back just the apps that are currently in use. The downside of a lean iTunes library is that finding an old app is hit or miss - needing to recall when it was saved to Time Machine. This hesitation also acts as a deterrent to keeping iTunes lean since I don't have a good process for archiving these programs.

What are people doing to have all copies of iOS apps organized without depending on Time Machine exclusively? I'm looking for an automated process for archiving apps delivered from the iOS app store.

share|improve this question

1 Answer 1

up vote 4 down vote accepted

Indeed, iTunes will simply throw in the Trash any item that is replaced by a subsequent update, which is a handy getout clause if you notice that you need the old version back quickly, before you empty it, but isn't exactly a robust solution with long term options.

Using Time Machine is a simple way of checking back through your history, and should be very effective on the understanding that you are using it regularly and to the normal hourly schedule, but may people don't have it setup, or use an external disk that is often not connected for long periods of time (guilty as charged).

So, they key is to get ahead of iTunes, and create your own archive of Apps, and you can break this down into 2 simple steps, the first being noticing when an app has changed, the 2nd being to do something about it.

You can happily write a script that you schedule to check for changes to select files and folders, but this is inefficient when you can simply use built in OS features such as Folder Actions, which are a much neglected yet insanely useful and powerful set of tools.

A folder action is simply an action that is executed automatically whenever certain things happen within the folder to which is is applied. When the folder is opened, closed, or modified (and modifications include files being added, removed, or altered), the folder action script activates automatically.

The script that you apply to a folder action can be anything you like, and the simplest way is to create something within Automator, which allows you to string together various application specific functions with bits of AppleScript or even Shell scripts to achieve the end result, in our case taking a copy of updated apps and archiving them off.


  • So, to start off, let's start Automator, and choose Folder Action as your document type.

  • On the left hand side is a column (may require expanding, under Library) of collections of actions, choose Files and Folders, and in the list that appears under the adjacent column, drag the following two items into the space in the right of the screen:

    • Copy Finder Items
    • Rename Finder Items
  • Next, either create (or locate) a backup folder where you wish to store you backups, and in the Copy Finder Actions tasks, either browse to this location or simply drag it on top of the folder name to make it choose it.

  • The 2nd task, Rename Finder Items will likely be called "Add Date or Time" instead, which is odd, until you realise that this is simply the first method of renaming that is offers. Change the selection to read "Make Sequential", the default options should be self explanatory, adding a number to each file that is renamed, starting with -1.ipa etc. (note that the file renaming takes place before the file extension, so you will get file-1.txt, not file.txt-1)

  • Now, above your two tasks, you have likely spotted the option to choose the folder to which the action is applied. Browse away and locate your mobile Apps folder in here, it's likely to be something in ~/Music/iTunes/iTunes Media somewhere, exact location dependant on the age of your iTunes library, current iTunes version, and dependant on how you let iTunes organise your folders, for me it was Mobile Applications in the above folder. You are essentially looking for a folder stuffed full of files ending in .ipa.

  • Your Automator should now look something like this:

Automator Window

  • Now you can save your action, I called mine "Itunes App Backups", don't worry where it saves the file to (which is actually ~/Library/Workflows/Applications/Folder Actions/)

  • You now have the action you just created, applied against the folder you chose. You can prove this, just right click on any folder and click "Folder Actions Setup", from here you can pick a pre-existing action and assign it to a folder without having to recreate the whole thing just by choosing to add from the list of known actions you are presented with; note that your new action is listed in the options provided, but hit cancel for now. You will see a list of folders which have actions assigned against them. Select your Mobile Applications Folder, and there you see the following:

Folder Actions Window

  • That's it. Because iTunes removes and replaces applications with upgrades, then each new file has a copy taken at the time it is added, meaning that it doesn't matter when it subsequently get's removed. Note that sometimes Apps include version information in the file names, sometimes they change names completely (Read It Later becoming Pocket, for example), and sometimes they use the same name exactly (which is where the renaming with sequential numbering comes in for added safety)

Note, that you can amend or expand this workflow to do all sorts of clever things, from keeping a set number of versions, removing any files older than X months at the same time etc etc, and if named sensibly you can apply the same workflow to multiple folders, thus creating your own personalised archiving mechanism for things other than just Apps for example. Also, note that if you subsequently replace an upgraded app with one of your own backups, it will get backed up again, which is something you might like to be aware of for such files that retain the same filename and are only distinguishable by their timestamps.

Note that a lot of the ideas in the post were inspired by a Macworld Article, which introduces the same process but in less detail

share|improve this answer
1  
Wow, fantastic answer! –  Ash May 5 '12 at 13:48
    
I'm going to have to entice you to keep this updated with the new iTunes once it gets finally released. –  bmike Nov 5 '12 at 21:22
    
I'm hoping it will pretty much still stand. But it's important to start doing this now, since the iPad 1 in my house is the first device that is in danger of auto-updating to a non-compatible version of an app... –  stuffe Nov 5 '12 at 22:43

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.