Need some help on my Music Folder Backup Script

Hi there,
I am having problems with my back up script, and i’m not to sure what is going wrong. But of course all these smart Applescript guru’s i’m sure i am doing something wrong some where. If there is a way to condense the script too that would be a help.

I wake up each day this week wondering what i did wrong, I like this backed up daily and have the script being launched by script in iCal.

I have an extensive music libray being a DJ by Trade, and I would love to know each day my script is backing up properly.

Everything seems to copy from the music folder, and it’s the delete the folder after done is not working so well. Here is the script:

set MusicFolder to alias "MacHD:Users:me:Music:" -- regular start up disk and my music folder stuff

set thePath to alias "ExternalDrive:Music:" -- External Drive  Where Backup is now...
tell application "Finder"
	set name of folder thePath to "Music_old"
	set thePath to alias "DarkBlue:Music_old"
	set backUpDrive to alias "ExternalDrive:"
	make new folder in backUpDrive with properties {name:"Music"}
	set BUMusic to alias "ExternalDrive:Music:"
	
	set now to (current date) -- assign date for iCal
	set eStart to now + 1 * minutes
	set eEnd to now + 2 * minutes
	set eName to "iTunes BU Complete"
	set d to every item of MusicFolder
	try
		with timeout of 3800 seconds -- set high as i have a 75 gig library -- usually 50 minutes to copy
			duplicate d to folder BUMusic
		end timeout
		-- if timeout successful then mark iCal
		tell application "iCal"
			set newEvent to make new event at end of events of calendar "Backup Notes" with properties {summary:eName, start date:eStart, end date:eEnd}
		end tell
		-- get rid of all files immediately delete by folder
		do shell script "rm -rf " & quoted form of POSIX path of thePath
		
		--delete thePath
	on error errMsg
		display dialog "ERROR :
     Problem backing up iTunes. 
     " & errMsg buttons {"OK"} default button 1 with icon 0
	end try
end tell

Any help would be much appreciated… Thanks!

Hi,

I’m wondering why you don’t use the shell command rsync, which does an intelligent backup.
It copies only the new or changed files and there’s also no problem with a timeout.

This line makes a backup of your music folder to the folder “Music” of the disk “ExternalDrive”


do shell script "/usr/bin/rsync -atE " & quoted form of POSIX path of (path to music folder) & space & quoted form of "/Volumes/ExternalDrive/Music/"

Stefan,
Thanks so much… works great! I have been an apple user now since my MacPlus. Wow long time… And i have never ever heard of this rsync.

Wicked program. Thanks so much for pointing this out to me. Runs great!