How to Copy a File to Multiple Directories in Linux

If You Appreciate What We Do Here On TecMint, You Should Consider:

  1. Stay Connected to: Twitter | Facebook | Google Plus
  2. Subscribe to our email updates: Sign Up Now
  3. Use our Hosting referral link if you planning to start your blog ($3.82/month).
  4. Become a Supporter - Make a contribution via PayPal
  5. Support us by purchasing our premium books in PDF format.
  6. Support us by taking our online Linux courses

We are thankful for your never ending support.

Aaron Kili

Aaron Kili is a Linux and F.O.S.S enthusiast, an upcoming Linux SysAdmin, web developer, and currently a content creator for TecMint who loves working with computers and strongly believes in sharing knowledge.

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide

You may also like...

9 Responses

  1. Aliabbas Syed says:

    Nice article. I often have to move files to another system to multiple dir. I use SCP for that. e.g. scp /source/dir/file1 file2 file3 @:/target/dir

  2. Georgina says:

    Thanks for the info! In turn, some for you: The article AN is used before singular, countable nouns which begin with vowel sounds. Thus “…an easy way…”
    Cheers

  3. Raj says:

    Nice article, I think xargs option “-n 1” – tells xargs to use 1 argument per command line at a time. (single line input to xargs has two whitespace separated arguments)

  4. buster says:

    You aways come up with something great, I can just wait to see what you have for next week. I follow you all the time and this is just another example of content sharing.

  5. yazul says:

    an other (simpliest ?) solution :

    for dir in dir1 dir2 dir3
    do
    cp -v file1 file2 file3 $dir
    done

    for…do…done is basment of shell power

Got something to say? Join the discussion.

Your email address will not be published. Required fields are marked *

Join Over 300K+ Linux Users
  1. 202,035
  2. 9,267
  3. 38,621

Are you subscribed?