Hey Everyone!
I ran into a situation last night where I wanted to sync two folders on my Mac, so I wrote an Applescript that I think does the trick (I haven't tested it out thoroughly, yet).
Here it is - I welcome any feedback or suggestions!
-futureswitcher
I ran into a situation last night where I wanted to sync two folders on my Mac, so I wrote an Applescript that I think does the trick (I haven't tested it out thoroughly, yet).
Here it is - I welcome any feedback or suggestions!
-futureswitcher
Code:
tell application "Finder"
set projDate to modification date of folder "folder" of folder "Projects" of home
set docDate to modification date of folder "folder" of folder "Documents" of home
set difference to projDate - docDate (*if difference is positive, the projects folder is newer*)
end tell
if difference is less than 0 then
display dialog "Syncing will overwrite changes to Projects. Do you want to continue?" buttons {"Cancel", "Ok"}
if button returned of result is "Ok" then
do shell script "cp -R ~/Documents/folder ~/Projects/"
end if
else if difference is greater than 0 then
display dialog "Syncing will overright changes to Documents. Do you want to continue?" buttons {"Cancel", "Ok"}
if button returned of result is "Ok" then
do shell script "cp -R ~/Projects/folder ~/Documents/"
end if
end if