Main Tutorials

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 Author

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

Comments

Subscribe
Notify of
5 Comments
Most Voted
Newest Oldest
Inline Feedbacks
View all comments
Swapnil Jain
4 years ago

How to copy all the subdirectory and files to another directory. NOTE:- the directory should not copy itself only its subdirectory should be copied to another directory.

dhanesh mane
13 years ago

Thanks for such a informative blog.

Dheeraj
4 years ago

Thanks for the Help

fawwad
5 years ago

Thanks for the assistance, you help me to do my job!

asdf
10 years ago

tanku.