An AppleScript trick turns any NAS device into a Time Machine drive

Tuesday, November 10th, 2009

Biggs is the editor of TechCrunch Gadgets. Biggs has written for the New York Times, InSync, USA Weekend, Popular Mechanics, Popular Science, Money and a number of other outlets on technology and wristwatches. He is the former editor-in-chief of Gizmodo.com and lives in Bay Ridge, Brooklyn. You can Tweet him here and G+ him here. Email him directly at john@techcrunch.com. → Learn More

genius
You can turn any network attached storage device into a Time Machine back-up drive with one simple step.

Simply download this app package and drag your drive onto it. The script adds the drive as a Time Machine capable device and then you can simply add it under Time Machine System Preferences.

The full script is right here if you want to roll your own:

on open names
set volumeName to names as text
set macAddress to (do shell script "ifconfig en0 | grep ether | tr -d '\11' | sed s/ether// | sed 's/ //g' | sed s/://g")
set hostName to (do shell script "hostname -fs")
tell application "Finder"
set theSize to round (((capacity of startup disk) / 1024 / 1024) / 1024)
end tell

do shell script "defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1" with administrator privileges

do shell script "sudo hdiutil create -size " & theSize & " -type SPARSEBUNDLE -nospotlight -volname \"Backup of " & hostName & "\" -fs \"Journaled HFS+\" ~/" & hostName & "_" & macAddress & ".sparsebundle" with administrator privileges
do shell script "mv ~/" & hostName & "_" & macAddress & ".sparsebundle /Volumes/" & volumeName & "/" with administrator privileges

tell application "Finder" to eject volumeName

tell application "System Preferences"
activate
end tell

tell application "System Events"
tell application process "System Preferences"
set frontmost to true
click menu item "Time Machine" of menu "View" of menu bar 1
end tell
end tell

end open

via MacOSXHints

Sponsored Ads

blog comments powered by Disqus

Sponsored Ads

Sponsored Ads

Events

Crunchies Awards
January 31, 2012
Davies Symphony Hall
San Francisco CA
Learn MoreBuy Tickets