Saturday, January 20, 2018

#1 2013-05-08 01:12:34 pm

Registered: 2011-11-18
Posts: 7

Duplicate Folder Structure

Hey everyone,

I'm trying to create an automator service that will duplicate a folder structure to a new location. I found a way to do what I need using Terminal:

$ rsync -a /path/from/ /path/to/ --include \*/ --exclude \*

So now I'm trying to accomplish the same thing in automator. I have the following;

1. Ask for Finder Items
result is something like:
{alias "Macintosh HD:Users:xxx:Desktop:Folder 1:", alias "Macintosh HD:Users:xxx:Desktop:Folder 2:"}

2. Run Applescript


on run {input, parameters}
   set pathFrom to the POSIX path of input's item 1
   set pathTo to the POSIX path of input's item 2

   do shell script "$ rsync -a " & quoted form of pathFrom & " " & quoted form of pathTo & " --include \\*/ --exclude \\*"
   display dialog "Folder structure has been replicated!" buttons {"OK"}
end run

It always fails. Does anyone know what I'm doing wrong? Thanks in advance.

Filed under: applescript, Automator



Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)