I’m writing a script to backup some folders to my iPod.
I’m backing up several folders and instead of listing each folder and the command, I like to have a list of folders at the start of the script and have the command repeat for each folder.
Here’s what I’m currently doing:
set this_iPod to "iDonut:" -- Remove from real script
(* Backup *)
set BackupFolder to "Backup:"
set HOmeBackupFolder to "Home Backup"
set MyLocation to this_iPod & BackupFolder & HOmeBackupFolder as string
try
get MyLocation as alias
on error
tell application "Finder"
make new folder at this_iPod & BackupFolder with properties {name:HOmeBackupFolder}
end tell
end try
(* Sparseimage to Backup *)
set SourceFolder to (path to home folder as string) & "Documents:Area 52.sparseimage"
do shell script ("rsync -aE --delete-after " & (quoted form of POSIX path of SourceFolder & space & quoted form of POSIX path of MyLocation)) & " || echo -n"
(* My Stuff to Backup *)
set SourceFolder to (path to home folder as string) & "Documents:My Stuff"
do shell script ("rsync -aE --delete-after " & (quoted form of POSIX path of SourceFolder & space & quoted form of POSIX path of MyLocation)) & " || echo -n"
(* Web Receipts to Backup *)
set SourceFolder to (path to home folder as string) & "Documents:Web Receipts"
do shell script ("rsync -aE --delete-after " & (quoted form of POSIX path of SourceFolder & space & quoted form of POSIX path of MyLocation)) & " || echo -n"
(* Delicious Library to Backup *)
set SourceFolder to (path to home folder as string) & "Library:Application Support:Delicious Library"
do shell script ("rsync -aE --delete-after " & (quoted form of POSIX path of SourceFolder & space & quoted form of POSIX path of MyLocation)) & " || echo -n"
(* Sounds to Backup *)
set SourceFolder to (path to home folder as string) & "Library:Sounds"
do shell script ("rsync -aE --delete-after " & (quoted form of POSIX path of SourceFolder & space & quoted form of POSIX path of MyLocation)) & " || echo -n"
Ideally I’d like to just list the locations:
Set DeliciousLibrary to (path to home folder as string) & "Library:Application Support:Delicious Library"
set SoundsFolder to (path to home folder as string) & "Library:Sounds"
Then run the rsync command.
Can anyone point me in the right direction?
Model: iMac
AppleScript: 2.1.1
Browser: Safari 523.12.2
Operating System: Mac OS X (10.5)