Paste files to multiple destinations I get into this situation quite often but haven't found a solution. I have a group of CSS files in the clipboard that I need to paste + replace into several different destination folders. My folder structure is similar to

.
├── folderA_11
|   └── CSS
|        └── file1.css
|        └── file2.css
|        └── file3.css
├── folderB_11
|   └── CSS
|        └── file1.css
|        └── file2.css
|        └── file3.css
├── folderC_11
|   └── CSS
|        └── file1.css
|        └── file2.css
|        └── file3.css
├── folderD_22
|   └── CSS
|        └── file1.css
|        └── file2.css
|        └── file3.css
├── folderE_33
|   └── CSS
|        └── file1.css
|        └── file2.css
|        └── file3.css
└── folderF_44
    └── CSS
         └── file1.css
         └── file2.css
         └── file3.css
etc...


There's a pattern: I want to paste to all CSS folders whose container ends in _11 but not any of the others.

The content of the destination folders doesn't matter, I just need to replace them with the new files. Is there a simple way to paste these files into multiple destinations at once? It could also be an Automator flow or Terminal command.
1 - Open Automator and create a new Service:




2 - Set the Service to receive Files and Folder in Finder:




3 - Drag an "Ask for Finder Items" action:




4 - Drag a "Run AppleScript" action:




5 - Paste this code:



on run {input}
    set numItems to count input
    set theFile to item (numItems) of input as text
    set numItems to numItems - 1
    repeat while numItems is not 0
        tell application "Finder"
            duplicate file theFile to folder (item (numItems) of input as text) with replacing
            set numItems to numItems - 1
            delay 0.1
        end tell
    end repeat
    display dialog "File copied to all folders" buttons {"Thanks"} giving up after 5
end run





6 - Save your workflow and name it as you want:





7 - USAGE:
Select as many folders as you want, right click, services, find your workflow:



Select the file you want to copy (beware the window can be hidden behind the main one):



Click "Choose" and wait for the copy.



PS: the file will replace existing ones with the same name.