-- Actual Script --
on Loop()
tell application "Finder"
set sourcefiles to item 1 of SourceHD & ":Users:" & item 1 of User & ":" & item 1 of SourceFolder & ":" & item 2 of SourceFolder as alias
try
set target_folder_1 to item 1 of NASVolume & ":" & item 2 of NASDropFolder as alias
set mounted_Disks to list disks
if mounted_Disks contains item 1 of NASVolume then
duplicate (every file of the entire contents of sourcefiles whose name extension is in {"JPG", "NEF", "RAW", "RAW2"}) to the target_folder_1 with replacing
-- Only use the following line if you want to delete the files in the source folder
delete (every file of the entire contents of sourcefiles whose name extension is in {"JPG", "NEF", "RAW", "RAW2"})
end if
end try
end tell
end Loop

macrumors newbie

Your script is the only one I've come across that is close to what I am interested in doing, but I'm curious how to add a few variables.

My intention is to add any folders and files nested within "Music" locally to the "NAS Music" folder on a local NAS.

The idea being that music added to the local folder could later be added to the NAS, the entire music archive living on the NAS would not delete folders or files. So that I could delete music from the local without destroying the collection on the NAS.

In theory:
Source= Music
Destination= NAS Music
add any files from "Music" to "NAS Music" if not already in "NAS Music"

The questionable part is how can you tell Apple Script to check all files and folders nested within "Music" against all files and folders nested within "NAS Music" and only update files and folders that are not already in "NAS Music". Additionally, it would be helpful to keep the structure of the nested folders intact.

...into a file here, "/Library/LaunchAgents/com.ghostotter.sync.plist", then load it like this (in Terminal)

Code:

launchctl load -w /Library/LaunchAgents/com.ghostotter.sync.plist

Then the two folders (coloured red above) will be synched every 60 seconds (adjust by changing the number in green above).

Obviously, you probably want to adjust the name of the plist, the folder paths and intervals to something that makes sense to you. You probably want to do some checking to make sure both folders exist too.

MacRumors attracts a broad audience
of both consumers and professionals interested in
the latest technologies and products. We also boast an active community focused on
purchasing decisions and technical aspects of the iPhone, iPod, iPad, and Mac platforms.