Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Merge Folders AppleScript

Installation

  • Run Automator
  • Select Service as the new document type
  • Find Run AppleScript from the Library and drag into the workflow
  • Copy the script code into the Run AppleScript action
  • Save as Merge Folders

Optional

  • Open System Preferences -> Keyboard -> Shortcuts
  • Add key combination for merge folders service

Usage

  • Select a folder
  • From (context) menu select Services -> Merge Folders
--- Merge Folders v1
--- Author: c0der78@gmail.com
--- handler for performing the merging.
on merge(src_paths, dest_path)
--- Uses the 'ditto' shell command as a backend
set cmd to "ditto " & src_paths & quoted form of dest_path
try
do shell script cmd
on error
--- Retry with admin privileges on error
do shell script cmd with administrator privileges
end try
end merge
on run {input, parameters}
set dest to choose folder with prompt "Select destination for merge:"
set dest_path to (POSIX path of dest) as text
set src_paths to ""
repeat with idx from 1 to count (input)
set src_paths to src_paths & (quoted form of (POSIX path of item idx of input as text)) & " "
end repeat
try
merge(src_paths, dest_path)
on error msg
display dialog the msg
end try
end run
@kevinSuttle

This comment has been minimized.

Copy link

kevinSuttle commented Dec 11, 2013

Unfortunately doesn't seem to work on Mavericks. :/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.