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. If you like my tutorials, consider make a donation to these charities.

Comments

avatar
6 Comment threads
0 Thread replies
0 Followers
 
Most reacted comment
Hottest comment thread
5 Comment authors
DheerajSwapnil Jainfawwadasdfdhanesh mane Recent comment authors
newest oldest most voted
fawwad
Guest
fawwad

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

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.

Dheeraj
Guest
Dheeraj

Thanks for the Help

Swapnil Jain
Guest
Swapnil Jain

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.

asdf
Guest
asdf

tanku.