Question: I've some new files in a folder A. I want to replace the old files which are located in different folders (ex. B, C, D), with the new files. Is there any way to do this in one shot by writing some script in Mac OS?

For example, the new files are located in `/Updatede`, and have names such as: `flower1.jpg`, `flower2.jpg`, `flower3.jpg`.

Now I want to replace below old files 

```
/Workarea/AssetGroupOne/flower1.jpg 
/Workarea/AssetGroupTwo/flower2.jpg 
/Workarea/AssetGroupThree/flower3.jpg
/Workarea/AssetGroupSix/flower1.jpg

```

I want to be specific like `/Updated/flower1.jpg` should replace only the `/Workarea/AssetGroupOne/flower1.jpg` not the `/Workarea/AssetGroupSix/flower1.jpg`

Note: I have more files, but for the sake of brevity, I have not listed them all here.

Answer: 
Try this,

```
#!/bin/bash
cd /Updated &&
for i in *
do
        find /Workarea -name "$i" -exec cp -f /Updated/"$i" {} \;
done

```
```
#!/bin/bash
cd /Updated
mv flower1.jpg /Workarea/AssetGroupOne/
mv flower2.jpg /Workarea/AssetGroupTwo/
mv flower3.jpg /Workarea/AssetGroupThree/

```

I wonder though, writing the script takes longer than just moving the files in Finder (or typing the commands above into the command line).