Re: auto backup Applescript?
Re: auto backup Applescript?
- Subject: Re: auto backup Applescript?
- From: email@hidden
- Date: Mon, 26 Apr 2004 09:53:08 -0400
Does anyone have a script that could run itself automatically at a
certain time everyday that
would take a file and make a copy of it in completely different folder?
...
I corrupted my iTunes Music Library data file, and lost all of my
song info. I have a back up somewhere,
but it's at least 2 months old I think, which does me really no good.
...
Anyone have something like that already written or can whip it up
quickly? I'd really appreciate it...
Here is one possibility.
-----
-- Created 26 April 2004. SJWL - dual 500 MHz G4, MacOS X 10.3.2.
-- 'iTunesMusicLibraryListBackup.scpt' creates a Backup Copy of the
'Music Library' Files from the User's '~/Music/iTunes' Folder into a
'/Documents/iTunes_Backup' Folder.
on idle {}
set hoursLapse to 6 -- Number of Hours to wait before duplicating
'Music Library' Files.
my BackUpiTunes()
return 60 * 60 * hoursLapse -- Seconds x Minutes x Hours.
end idle
on BackUpiTunes()
set iTunesFolder to "iTunes" -- Folder whose 'Music Library' Files to
duplicate.
set sourceFolder to (((path to music folder) as string) &
iTunesFolder) -- Path of current User's iTunes Folder.
set documentsFolder to (((path to startup disk) as string) &
"Documents:") -- Path of where User's Backup Folder will be placed.
set iTunesBackupFolder to (iTunesFolder & "_Backup") -- Folder which
contains the duplicated 'Music Library' Files.
tell application "Finder" to if (not (folder (documentsFolder &
iTunesBackupFolder) exists)) then make new folder at alias
documentsFolder with properties {name:iTunesBackupFolder} -- If no
Folder exists, create one.
set iTunesFolderList to list folder (sourceFolder) without invisibles
-- Obtain List of current User's 'iTunes' Folder.
repeat with i in iTunesFolderList -- Cycle through the current User's
'iTunes' Folder List.
if ((name of (info for file (sourceFolder & ":" & i))) contains
"Library") then tell application "Finder" to (duplicate (file i of
folder (sourceFolder & ":")) to (folder (documentsFolder &
iTunesBackupFolder)) with replacing) -- If File contains 'Library'
back it up.
end repeat
end BackUpiTunes
-----
You must 'Save' [or 'Save As ...'] the above Code [or a Copy of it]
as 'Application' with the 'Stay Open' Check Box checked [with a Check
Mark visible], and then run the Applet [an AppleScript 'Application']
Version.
Launch 'System Preferences' and drag the Applet's Icon onto the
'Accounts' 'Startup Items' List.
Every time you turn ON your Mac the 'iTunes' 'Music Library' Files
will be back'ed up, and then every 'hoursLapse' after that. The back
up Process is quick and will occur behind any currently running
Application [Process].
An Icon of the 'iTunesMusicLibraryListBackup' Applet will be present
on your 'Dock', thus you can '<control> - click' [right Button click
with a two+ Button Mouse] on the Icon to present a Contextual Menu -
in order to quit the Applet.
Having the Mac backup the 'Music Library' Files at a specific Time of
Day is left as an Exercise for the Student.
--
SJWL
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.