It sounds like a simple question but if it was I wouldn't be asking it. I can obviously do this by opening all the folders in nautilus and pasting each one individually but the computer is the robot not me (I'm talking about 500 files).

So is there a way of doing this more efficently by gui or command line? either is as good as the other.

If it makes you feel better you will be saving a poor "V" key from severe punishment.

3 Answers 3


If the folders are in the same folder that the file exists, then use:

for dir in *; do [ -d "$dir" ] && cp YOURFILE.EXT "$dir" ; done

In other scenery, if the file is in a different path, use:

for i in folder1 folder2 folder3 folder4; do cp YOURFILE.EXT $i; done

If you don't know what exactly are the names of the folders where to put the file, try:

There is no need to make a script. Simply drop these commands in a terminal and check the results.


YOURFILE.EXT = The name of your file, may contain the full path.
folder1 folder[...] = the name of the folders where to drop the file,
-- folder names may contain the full path.
  • Why exactly shouldn't we comment on your answer? Commented Mar 23, 2011 at 10:18
  • 1
    Feel free to post your comments, but if you have a better solution, then your suggestions are not for me but the owner of the question. If you check in my previous answers, many people have said something like: "my solution is better" and down vote my suggestion, but they don't dare to drop their solution in an answer whose behavior leads to just a confrontation (which I don't face indeed) and don't lead to the obtaining of a good solution. Commented Mar 23, 2011 at 16:15
  • Thanks Geppettvs the first command was the winner just a note for others it wont work over samba you would need to replace the cp with gvfs-copy
    – Allan
    Commented Mar 23, 2011 at 19:27
  • 1
    Don't worry too much about that, if your solution is good then it will be upvoted/accepted, like in this case. Sometimes a comment can improve the solution, you don't have to treat them as a personal attack. Commented Mar 23, 2011 at 21:59

I can make touch {jan,feb,mar}-{Rep.xls,graph.xls} makes feb-graph.xls jan-Rep.xls feb-Rep.xls mar-graph.xls jan-graph.xls mar-Rep.xls
But i cant open them. So i wanted to make one file 1.ods saved from OO-Calc and then wanted to cp it similar like touch {jan,feb,mar}-{Rep.xls,graph.xls} using cp 1.ods {jan,feb,mar}{Rep.ods,graph.ods} but that doesnt work. cp: target `margraph.ods' is not a directory SO im also interested in this


find . -type d | xargs -I{} cp ./myfile {}/

This is how I got the job done.

Here was the problem I wanted solved. I wanted to test all my new virtual hosts before installing the actual applications.

find . -type d
find . -type d | xargs -I{} cp ./php.info {}/ 
ls ./*




You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .