How to copy a folder to multiple folders using command line? [duplicate]

Solution 1:

I'd suggest using a while ... do loop

while read -r d; do
  cp -R -- foo/ "$d"
done < destinations.txt

Alternatively, using xargs

xargs -n1 -a destinations.txt cp -R foo --

Solution 2:

Assuming your first folder is called foo and you want to copy it to directories, which are specified in destinations.txt (one per line).

You could use a for-loop for this:

for i in $(cat destinations.txt)
do
  echo "$i" #prints the name of the current target -> you can see progress, if it takes long  
  cp -R foo/ "$i"
done