copying to multiple directories using wildcard

Can we copy a file to multiple directories using a single command line , i tried with * didnt work for me

cp /tmp/a.kool /tmp/folder/*/keys/

I am tryn to copy a.kool file to all keys folder in /tmp folder. is something i am missing ?

This will copy a.kool and everything from /tmp/folder/* to /keys/.

You can use looping.

Make a list of folders where you want to copy in a text file.

for a in `cat list.txt`; do copy a.kool $a/; done;

find /tmp/folder/ -type d -name keys -exec cp /tmp/a.kool {}\;

but be careful :wink:

Try this :slight_smile:

find . -path "/tmp/folder/*/keys/" -type d -exec cp /tmp/a.kool {} \;

may be similar to previous post :slight_smile:

sorry small correction

find /tmp/ -path "/tmp/folder/*/keys/" -type d -exec cp /tmp/a.kool {} \;