Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the '10.4: An AppleScript to automate Address Book backups' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.4: An AppleScript to automate Address Book backups
Authored by: kainewynd2 on Dec 02, '05 01:07:58PM
As flyingcactus pointed out, this is a rather drawn out and involved way of backing up Address Book info. I took his advice and made a MUCH simpler AppleScript that just copies the local AddressBook folder from ~/Library/Application Support and dumps it into a dated directory in your Documents/ABBackup folder (you still need to make that folder by hand, if anyone could throw a folder checking and creation applescript page at me, I would really appreciate it). Below is the code:

do shell script "date +%m-%d-%y" -- Gets the Date
set todaysDate to result 
set folderName to "ABBackup_" & todaysDate -- Sets variable for Making dated folder
do shell script "echo $USER" -- Gets username
set userName to result
do shell script "mkdir /Users/" & userName & "/Documents/ABBackup/" & folderName & "/" -- Makes dated folder, ideal for Daily backups at the moment
do shell script "ditto '/Users/" & userName & "/Library/Application Support/AddressBook/' /Users/" & userName & "/Documents/ABBackup/" & folderName & "/" -- Dittos the Address Book to ~/Documents/ABBackup/datedfolder


[ Reply to This | # ]
10.4: An AppleScript to automate Address Book backups
Authored by: mark hunte on Dec 02, '05 06:30:56PM
do shell script "date +%m-%d-%y" -- Gets the Date
set todaysDate to result
set dated_folder to "ABBackup_" & todaysDate -- Sets variable for Making dated folder
tell application "Finder"
	set backup_Folder to "ABBackup"
	set Sup_path_folder to path to application support from user domain as string
	set addbookFolder to folder "AddressBook" of folder Sup_path_folder as string
	set doc_path_folder to path to documents folder from user domain as string
	if not (exists folder backup_Folder of folder doc_path_folder) then
		make new folder at doc_path_folder with properties {name:backup_Folder}
	end if
	set backup_Folder to folder backup_Folder of folder doc_path_folder as string
	if not (exists folder dated_folder of folder backup_Folder) then
		make new folder at backup_Folder with properties {name:dated_folder}
	end if
	tell application "Finder"
		duplicate items of folder addbookFolder to folder dated_folder of folder backup_Folder with replacing
	end tell
end tell
<p>---<br>mh</code></pre>


[ Reply to This | # ]