Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Lawliet666

macrumors newbie
Original poster
Apr 8, 2011
1
0
Hi i'm new here.

I just created a Workflow to automatically synchronize my iTunes Library when I plug in my USB Drive.

I tried to create a Guide but it seems that i have to create 5 posts here first :/..and because i'm to lazy i will just create this one thread :p

The Guide is mostly based on this http://guides.macrumors.com/Talk:Keeping_two_iTunes_libraries_in_sync Guide

Info:
I have done all this steps on Mac OS X 10.6.7
I'm using Crowl to notify the user on start and end of the synchronization, i don't know what will happen if you don't have crowl installed.

So here my little guide:
1) Start the "Automator" Application and select the "Folder Action" Template
2) Now u have to select the folder on which the workflow will listen for changes
- we will select the folder "/Volumes" in which all external drives will be mounted
- open the chose folder dialog click on "Macintosh HD" (thats the default name of your hard disc)
- press "SHIFT" + "CMD" + "." to see system files and select the folder "/Volumes"
3) Search the workflow "Actions" for "Run AppleScript" and drag this actions to the workflow window
4) Copy and paste the following code to the editor area and replace "YOUR_DRIVE_NAME" with the name of your USB Device

on run {input, parameters}

set drive to "YOUR_DRIVE_NAME"

return {drive}
end run

5) Create another "Run AppleScript" task and drag it bellow the other task.
6) Copy and paste the following code to the editor area:

on run {input, parameters}

set drive to item 1 of input

tell application "GrowlHelperApp"

set the allNotificationsList to ¬
{"ITunes Syncer"}

set the enabledNotificationsList to ¬
{"ITunes Syncer"}


register as application ¬
"ITunes Syncer" all notifications allNotificationsList ¬
default notifications enabledNotificationsList ¬
icon of application "Automator"

end tell

tell application "Finder"
if disk drive exists then

tell application "GrowlHelperApp"

notify with name ¬
"ITunes Syncer" title ¬
"ITunes Syncer" description ¬
"Starting Sync for Drive '" & drive & "'" application name "ITunes Syncer"

end tell

else

-- Error Code for Cancel Button pressed, Stops the Workflow
error number -128

end if

end tell

return drive
end run​

7) Create a "Run ShellScript" task bellow the other tasks and paste to following code to the editor.
- If your ITunes Library is on a different location than the default one you will have to replace "~/Music/iTunes" with the location of your iTunes library.
- This command will synchronize the whole iTunes library with the "/Music" folder on your USB Device, if you wish to synchronize with a different folder just change "/Music" to whatever you wish.
- It will also log the last execute of the command to "~/Documents/AutomatorLogs/iTunesMSync.log".
- You will have to create the folder "Music" on your USB Device and the folder "~/Documents/AutomatorLogs/" before the first time you run the workflow.
- For every other information about this command please check http://guides.macrumors.com/Talk:Keeping_two_iTunes_libraries_in_sync

rsync -av --force --delete --size-only ~/Music/iTunes /Volumes/$@/Music > ~/Documents/AutomatorLogs/iTunesMSync.log​

8) Create a "Show Crowl Notification" task below the other task fill the following fields:
Title: ITunes Syncer
Description: Sync finished​


Sorry for my bad english i'm from austria :p
If you have any questions about this topic feel free to contact me via a forum message or just reply to this thread.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.