How to copy Entire Directory in Linux

Command is simple, here i provide two samples to show how to copy entire directory in linux.

cp -r sourcedir targetdir

for instance,

1) Copy anything from current directory to /usr/local/download

cp -r * /usr/local/download

2) Copy whole directory (include content) /usr/local/fromdownload to target /usr/local/download

cp -r  /usr/local/fromdownload  /usr/local/download

About the Author

author image
mkyong
Founder of Mkyong.com, love Java and open source stuff. Follow him on Twitter, or befriend him on Facebook or Google Plus. If you like my tutorials, consider make a donation to these charities.

Comments

Leave a Reply

avatar
newest oldest most voted
Linux Training in Hyderabad
Guest
Linux Training in Hyderabad

Hi, your article really nice. That is so logical and clearly explained. Keep it up! I will follow up your blog for the future post.

trackback
Move, Rename, Copy, Create, Delete & Manage Files/Directories in Linux

[…] That’ll be all for this. Hope you find it useful and do give your feedback.External Resources:How to copy entire directory in Linux5 Practical Examples To Delete / Remove Directory in LinuxHow to remove non-empty directories in […]

dhanesh mane
Guest
dhanesh mane

Thanks for such a informative blog.

asdf
Guest
asdf

tanku.