Skip navigation

Merge/import older iCal files to newer iCal?

1653 Views 19 Replies Latest reply: Jan 31, 2013 4:20 PM by John Maisey RSS
1 2 Previous Next
MrMur Calculating status...
Currently Being Moderated
Feb 16, 2012 9:32 AM

I'm trying to merge/import old iCal files from a circa-2005 iMac to my MacBook Pro (purchased in Dec. 2010). The files were pulled directly from the iMac onto an external hard drive, before the failing iMac stopped working completely. My iCal won't recognize the old files for importing. I just came back from the local Apple store Genius Bar, and the person there was stumped in whatever he tried. Is there a method for resurrecting these older iCal files? Thanks very much in advance for any help offered.

  • John Maisey Level 5 Level 5 (6,870 points)
    Currently Being Moderated
    Feb 19, 2012 4:09 PM (in response to MrMur)

    Hi,

     

    Are the calendars in .ics files?

     

    Best wishes

    John M

  • John Maisey Level 5 Level 5 (6,870 points)
    Currently Being Moderated
    Feb 20, 2012 1:49 PM (in response to MrMur)

    Hi MrMur,

     

    The .icalevent files are 'metadata' files used to help Spotlight index your data in OSX 10.4. They do not contain enough data to give you any more than basic information for an event. For example they do not store the repeat pattern of an event.  The information could be extracted (I did it using Applescript), but it would never have held the full event information, just what Spotlight needed.

     

    The better files to get from the old OSX 10.4 backup are in ~/Library/Application Support/iCal (where ~ is the path to the old User's Home folder). Buried in there would have been one corestorage.ics file for each calendar. Do you still have the contents of that folder?

     

    Best wishes

    John M

  • John Maisey Level 5 Level 5 (6,870 points)
    Currently Being Moderated
    Feb 21, 2012 3:34 PM (in response to MrMur)

    Hi,

     

    Try the script below and let me know how it goes.

     

    Open Applescript Editor (Applications/Utilities/Applescript Editor) copy the script below into a new window and press the Run button. A window to select the folder where the files are stored will appear. Navigate and select the folder containing your files.

     

    As mentioned above you will only recover the title, notes and time of the events from the .icalevent files.

     

    Best wishes

    John M

     

     

    ----------------------------------------------
    -- John Maisey -- www.nhoj.co.uk -- 21 Feb 2012  --
    ----------------------------------------------
    set {myList, myCount, myFailures, calName} to {{}, 0, 0, "Recovered Events"}
    tell application "Finder" to set myPath to choose folder default location (path to desktop)
    set theFolders to my getSubFolders(myPath, {myPath})
    
    tell application "System Events"
              repeat with myFolder in theFolders
                        set myFiles to (files of myFolder whose type identifier is "com.apple.ical.bookmark")
                        repeat with thisFile in myFiles
                                  set end of myList to (value of property list file (POSIX path of thisFile))
                        end repeat
              end repeat
    end tell
    
    tell application "iCal"
      activate
              if name of calendars does not contain calName then make new calendar with properties {name:calName}
              repeat with myEvent in myList
                        try
                                  make new event at the end of events of calendar calName with properties {summary: (|summary| of myEvent), start date: (dueDate of myEvent), end date: ((dueDate of myEvent) + 1 * hours), description: (comment of myEvent), allday event: (fullDay of myEvent)}
                                  set myCount to myCount + 1
                        on error theErr
                                  set myFailures to myFailures + 1
      display dialog theErr
                        end try
              end repeat
              display dialog (myCount & " of " & (myCount + myFailures) & " events recovered to iCal") as text buttons {"OK"} default button "OK" with title "data recovery" with icon 1
    end tell
    
    on getSubFolders(myPath, mySet)
              tell application "System Events"
                        set myArray to folders of myPath
                        repeat with myItem in myArray
                                  set mySet to my getSubFolders(myItem, mySet)
                                  set end of mySet to (path of myItem) as alias
                        end repeat
              end tell
              return mySet
    end getSubFolders
    
    
  • John Maisey Level 5 Level 5 (6,870 points)
    Currently Being Moderated
    Feb 24, 2012 3:50 AM (in response to MrMur)

    Hi,

     

    In that case it looks like it didn't find the files by type identifier.

     

    Try replacing the line:

     

    set myFiles to (files of myFolder whose type identifier is "com.apple.ical.bookmark")
    

     

    with:

     

    set myFiles to (files of myFolder whose name extension is "icalevent")
    

     

    Let me know how it goes.

     

    John M

  • John Maisey Level 5 Level 5 (6,870 points)
    Currently Being Moderated
    Feb 27, 2012 12:06 PM (in response to MrMur)

    Hi,

     

    I cannot see the image you posted. Did it find any of the items?

     

    Best wishes

    John M

  • John Maisey Level 5 Level 5 (6,870 points)
    Currently Being Moderated
    Feb 29, 2012 8:26 AM (in response to MrMur)

    Sorry, still cannot see it.  What did the error message say?

  • John Maisey Level 5 Level 5 (6,870 points)
    Currently Being Moderated
    Mar 1, 2012 2:52 PM (in response to MrMur)

    MrMur wrote:

     

    The error message started with "Can’t get comment of {entityID"...

     

    I see. Try this one and let me know how you get on.

     

     

    ----------------------------------------
    -- John Maisey -- www.nhoj.co.uk -- 21 Feb 2012
    -- Modified 1 Mar 2012 
    ----------------------------------------
    set {myList, myCount, myFailures, calName} to {{}, 0, 0, "Recovered Events"}
    tell application "Finder" to set myPath to choose folder default location (path to desktop)
    set theFolders to my getSubFolders(myPath, {myPath})
    
    tell application "System Events"
              repeat with myFolder in theFolders
                        set myFiles to (files of myFolder whose name extension is "icalevent")
                        repeat with thisFile in myFiles
                                  set end of myList to (value of property list file (POSIX path of thisFile))
                        end repeat
              end repeat
    end tell
    
    tell application "iCal"
      activate
              if name of calendars does not contain calName then make new calendar with properties {name:calName}
              repeat with myEvent in myList
                        try
                                  set thisEvent to make new event at the end of events of calendar calName with properties {start datedueDate of myEvent), end date:((dueDate of myEvent) + 1 * hours)}
                                  try
                                            set summary of thisEvent to |summary| of myEvent
                                  end try
                                  try
                                            set description of thisEvent to comment of myEvent
                                  end try
                                  try
                                            set allday event of thisEvent to fullDay of myEvent
                                  end try
                                  set myCount to myCount + 1
                        on error theErr
                                  set myFailures to myFailures + 1
      display dialog theErr
                        end try
              end repeat
              display dialog (myCount & " of " & (myCount + myFailures) & " events recovered to iCal") as text buttons {"OK"} default button "OK" with title "data recovery" with icon 1
    end tell
    
    on getSubFolders(myPath, mySet)
              tell application "System Events"
                        set myArray to folders of myPath
                        repeat with myItem in myArray
                                  set mySet to my getSubFolders(myItem, mySet)
                                  set end of mySet to (path of myItem) as alias
                        end repeat
              end tell
              return mySet
    end getSubFolders
    
    
1 2 Previous Next

Actions

More Like This

  • Retrieving data ...

Bookmarked By (0)

Legend

  • This solved my question - 10 points
  • This helped me - 5 points
This site contains user submitted content, comments and opinions and is for informational purposes only. Apple disclaims any and all liability for the acts, omissions and conduct of any third parties in connection with or related to your use of the site. All postings and use of the content on this site are subject to the Apple Support Communities Terms of Use.