• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Backup for beginners
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Backup for beginners


  • Subject: Backup for beginners
  • From: Ruth Bygrave <email@hidden>
  • Date: Tue, 9 May 2006 12:44:06 +0100

I backup the whole 40Gb drive onto an external every once-in-a-blue-moon using CCC. I'm looking for a really fast backup of changes to folders of small text and xml files (and folders of folders of such), so that I can backup changed files to a small flash drive instantly, preferably before I go out.

I've got it to initialise (thanks to the several people who explained about the empty parameter brackets) and return an error if there isn't a flash drive.

I pass sFolder (source folder) and tFolder (target folder) to the backup routine. I used 'display dialog' to keep an eye on what files had changed.
I used the following rather clunky thing (with extra clunkiness bearing in mind that the Finder seemed to introduce a spurious 1-second difference between source and target dates for no apparent reason, leading to copying everything...).

Here is the initial clunky effort. Please point and laugh: I might learn something. Please don't point out if the end-ifs don't line up--that's a cut-and-paste error. All of it's inside a Finder tell block.

set fList to {}
set fList to list folder sFolder without invisibles
repeat with f in fList
set sName to sFolder & ":" & f
set sDate to modification date of item sName
set tName to (tFolder as string) & ":" & f
if (exists of item tName) is false then
try
duplicate item sName to folder tFolder
display dialog f & " has been created on target drive!" with icon stop
end try
else
set tDate to (modification date of item tName)
if sDate > tDate then
set diff to (sDate - tDate)
if diff > 1 then
duplicate item sName to folder tFolder with replacing
display dialog f & " has been modified on " & (tDate as string) & " on the target" & return & "and on " & (sDate as string) & " on the source" with icon caution
end if
end if
end repeat
end if


The main problem was that it ran like glue (about 30 seconds to go through various directories of small text files, although I'm not sure how much of the slowdown was added by 'display dialog'.  The secondary problem was that it didn't seem to backup some files that definitely had changed over a day ago (including the backup script itself!).

I looked things up in books. A 'whose' clause is apparently the way round the running-like-glue thing. I also realised that all I need for the target date is the date the target folder changed, so any items in the source folder changed since then should be copied.

Now I use:
set tDate to (the modification date of folder tFolder)
duplicate (every item of folder sFolder whose modification date comes after tDate) to folder tFolder with replacing

This seems to work, and a lot faster. Unfortunately, I don't see how I would get it to log what's changed. The previous clunky horrible thing did at least display the files with different icons for modified and created files. Also, now I look, it seems to have the same problem: the backup script doesn't seem to report to Finder accurately when it has been changed, because if I edit and save the file it doesn't show the changed modification date until I open it again (I think).
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Backup for beginners
      • From: Roger Howard <email@hidden>
    • Re: Backup for beginners
      • From: "Gary (Lists)" <email@hidden>
  • Prev by Date: Re: Exchange Calendar Access & Manipulation
  • Next by Date: Re: Exchange Calendar Access & Manipulation
  • Previous by thread: Re: Pathname Weirdness
  • Next by thread: Re: Backup for beginners
  • Index(es):
    • Date
    • Thread