Want to highlight a helpful answer? Upvote!

Did someone help you, or did an answer or User Tip resolve your issue? Upvote by selecting the upvote arrow. Your feedback helps others! Learn more about when to upvote >

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Script Help

I have written the following script:

tell application "Finder"
eject (every disk whose ejectable is true or not local volume is true)
end tell

delay 2

tell application "Finder"
mount volume "smb://192.168.0.5/SharedDocs"
end tell

tell application "Finder" to duplicate folder "Macintosh HD:Users:clbradford:Documents:" to folder "SharedDocs:corybackup:" with replacing

tell application "Finder" to duplicate folder "Macintosh HD:Users:clbradford:Library:Application Support:AddressBook:" to folder "SharedDocs:corybackup:" with replacing

tell application "Finder" to duplicate folder "Macintosh HD:Users:clbradford:Library:Application Support:Journler:" to folder "SharedDocs:corybackup:" with replacing

tell application "Finder" to duplicate folder "Macintosh HD:Users:clbradford:Library:Mail:" to folder "SharedDocs:corybackup:" with replacing

tell application "Finder" to duplicate folder "Macintosh HD:Users:clbradford:Library:Safari:" to folder "SharedDocs:corybackup:" with replacing

tell application "Finder" to duplicate folder "Macintosh HD:Users:clbradford:Library:Application Support:iCal:" to folder "SharedDocs:corybackup:" with replacing

tell application "Finder" to eject "SharedDocs"

It works perfectly how I want it to, but I was wondering if there was a way to only copy folders/files that have been modified since the last modification date.

Thanks

Posted on Oct 9, 2005 7:55 PM

4 replies

Oct 10, 2005 3:41 AM in response to Community User

I suppose you could test every folder for modification dates after a particular time:
<pre>tell application "Finder"
set f1 to every folder of entire contents of (path to documents folder) whose modification date is greater than (current date) - (7 * days) -- 7 days ago
set f2 to every file of entire contents of (path to documents folder) whose modification date is greater than (current date) - (7 * days)
end tell</pre>
- although I'm not convinced sometimes by the modification dates of folders. I suspect the Finder updates them when it changes the .DS_Store file, even if you just look at the folder. Still, it's a start, I suppose!

Oct 17, 2005 4:42 PM in response to reese_

MacOS X includes a version of rsync, but it has a critical bug. The version included with MacOS X writes the wrong modification dates if you use the --extended-attributes flag.

rsyncX does not have this problem.

I would suggest that anyone using rsync file a bug at bugreport.apple.com describing the problem. Here is the one I filed. Feel free to run similar scripts on your own system.

---
10.4.2 rsync incorrectly copies modification times when --extended-attributes flag is used.

Steps:
Install 10.4.2
Find a folder containing files with extended attributes. The following example uses the color sync profiles in Classic
Start terminal
mkdir Desktop/foo
/usr/bin/rsync --archive --extended-attributes /System\ Folder/ColorSync\ Profiles /Users/work/Desktop/foo/rsync

Expected:
Folder copies, data is there

Actual:
Folder is copied, but mod date information is lost. The mod date is set to the current date and time.

This makes it impossible to use rsync for synchronization, as the mod date is one of the ways it can tell a file has changed. This is a data loss problem.

Note that in the ls -la output, the original files had a date of Sep 14, 2000, while the new files have a date of Jun 2, 2005.

work@boggle:work$ ls -la /System\ Folder/ColorSync\ Profiles/
total 7368
drwxrwxr-x 53 root admin 1802 Apr 30 2004 .
drwxrwxrwx 36 root admin 1224 May 5 16:42 ..
-rwxrwxr-x 1 root admin 906804 Sep 14 2000 4:C Ctd. TRUMATCH:RIT:Profile80
-rwxrwxr-x 1 root admin 620 Sep 14 2000 Apple 12" RGB Standard
-rwxrwxr-x 1 root admin 620 Sep 14 2000 Apple 13" RGB Standard
-rwxrwxr-x 1 root admin 620 Sep 14 2000 Apple 16" RGB Page-White

and many other files dates Sep 14.

work@boggle:work$ ls -la Desktop/foo/rsync/ColorSync\ Profiles/
total 7368
drwxrwxr-x 53 work admin 1802 Apr 30 2004 .
drwxr-xr-x 4 work staff 136 Jun 2 10:37 ..
-rwxrwxr-x 1 work admin 906804 Jun 2 10:36 4:C Ctd. TRUMATCH:RIT:Profile80
-rwxrwxr-x 1 work admin 620 Jun 2 10:36 Apple 12" RGB Standard
-rwxrwxr-x 1 work admin 620 Jun 2 10:36 Apple 13" RGB Standard
-rwxrwxr-x 1 work admin 620 Jun 2 10:36 Apple 16" RGB Page-White

and many other files dated today.

This means rsync is broken, and that the Apple MacOS X web page describing the new extended-attributes support in MacOS X is misleading. This utility will not work in this state.

---

Script Help

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.