How do I create an Automator workflow, service or folder action to use ditto. The intention here is to use ditto to merge folders and/or files avoiding the unacceptable Finder's behavior of replacing the folder/file by the new one.
Answer
Create a Service that receives folders in Finder. Add a single Run AppleScript action to it with the following script code:
on run {input, parameters}
set dest to choose folder with prompt "Select destination:"
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
set cmd to "ditto " & src_paths & quoted form of dest_path
do shell script cmd
end run
The script will execute
ditto selectedFolder1 selectedFolder2 selectedFolderN folderChosenInDialog
Assign a keyboard shortcut for convenient access in System Preferences » Keyboard » Keyboard Shortcuts » Services.
No comments:
Post a Comment