| |||
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
|
> Does anyone have a simple (or not so simple) backup script they'd be > willing to share (off list or on list)? This script uses rsync to incrementally synchronize some folder to an ejectable disk, one way. Due to minor changes in rsync this script does not work in 10.4. Also, it can’t backup to a nonexistent folder, the target folder must already exist. An error handler could fix this. The script remembers settings after the first run, until recompiled. On error it will ask for new parameters. Once it is run, you can simply reuse the Terminal command or make a Terminal alias out of it. -- Gnarlie Backup a folder to a mounted Firewire disk. DELETES items on the mounted disk that have been deleted on the original. Works up to 10.3.9, will not work in 10.4 Has some problem copying Mac resource fork to a DOS_FAT_32 formatted disk, due to rsync. -- http://Gnarlodious.com/Apple/AppleScript/ property sourceFolder : missing value --set sourceFolder to "Rachel:The Velvet Turtle:" property targetDisk : missing value --set targetDisk to "Clarus" set rsyncDryRun to false set rsyncOptionsString to "a" set rsyncExcludeString to "--exclude=Cache?/ --exclude='Temporary Items/' --exclude=.Spotlight* --exclude=.Trash*" tell application "Finder" activate set ejectableDisks to every disk whose ejectable is true -- there must be a mounted disk if (count of ejectableDisks) is 0 then display dialog "There are no mounted disks" & return & "Reset current configuration or mount the disk and retry?" buttons {"Reset", "Retry"} default button 2 with icon stop set sourceFolder to missing value set targetDisk to missing value return else set ejectableDisks to ejectableDisks as alias as list if sourceFolder is missing value then -- is first run choose folder with prompt "Choose a folder to backup:" default location (home as string) as alias set sourceFolder to the result as alias choose folder with prompt "Choose a disk to backup onto:" default location (item 1 of ejectableDisks as alias) set targetDisk to the result as alias display dialog "These settings will be remembered" buttons {"OK"} default button 1 with icon note end if end if if ((disk of targetDisk) as alias) is in ejectableDisks then tell application "Terminal" activate if (count of windows) is 0 then do script "# Cloning folder " & (sourceFolder as string) delay 0.1 tell front window activate set custom title to "Cloning to disk" & space set background color to {0, 0, 0, 60000} set cursor color to "white" set normal text color to "green" set bold text color to "red" end tell end if do script "# Sending items..." in front window set cmd to "rsync -" & rsyncOptionsString & space & quoted form of POSIX path of sourceFolder & space & quoted form of POSIX path of targetDisk & space & rsyncExcludeString & " --delete --update --progress --eahfs" if rsyncDryRun is true then set cmd to cmd & " --dry-run" do script cmd in front window end tell -- update targetDisk else display dialog "Disk \"" & targetDisk & "\" is not mounted" buttons {"Quit"} default button 1 with icon stop return end if end tell |
_______________________________________________ Do not post admin requests to the list. They will be ignored. Applescript-users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/applescript-users/email@hidden This email sent to email@hidden
| References: | |
| >Simple Backup Script (From: Dana Hill <email@hidden>) |
| Home | Archives | FAQ | Terms/Conditions | Contact | RSS | Lists | About |
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE
Contact Apple | Terms of Use | Privacy Policy
Copyright © 2007 Apple Inc. All rights reserved.