1
2
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.
1
2
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.
1
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.
It works but not in the way I want. But it's my fault. I want to copy a folder named "my files" from a flash drive to a folder also named "my files" in my Documents folder (for example) what it should do is update the files not delete all the content and replace with the new one as is the default behavior. Like in Linux or even Windows. – msmafra – 2011-03-24T16:42:18.517
@tenshimsm Cannot reproduce. It doesn't clear destination for me. I gave you the command that is executed in my post, and you specifically requested use of
ditto
. If you want to add parameters to change ditto's behavior, it's trivial to edit the third to last line. – Daniel Beck – 2011-03-24T17:51:14.947@tenshimsm Screenshot when I tested it. Clearly
– Daniel Beck – 2011-03-24T20:03:34.4471
is destination, andc
existed only there, before performing the command.Your code is very useful for me. I try it and see if it is my "lameness". :) – msmafra – 2011-03-25T20:05:01.397