Copy entire folder in Linux

| | Comments (4)

To copy an entire folder (directory tree) in Linux, use the following method:

mkdir target_directory
cd source_directory
cp -ap . target_directory

Other options:
cp -apv . target_directory (for verbose results)
\cp -ap . target_directory (for unix)

More info:
- linuxguide.sourceforge.net

Categories




4 Comments

thanks for the script said:

How to go about moving the file.. mv does not work
with mv -apv ....

Ehsan said:

better explanation would be:

mkdir target_dir
cd source_dir
cp -ap . /path/to/target_dir

mkdir : makes directory
cd : goes to a directory
cp : command for copy
-ap : cp options for copying files/folders with the same attributes/permissions...
. : stands for all files/folders

kanani said:

sudo cp destination-dir target-dir -r

Miguel Costa said:

Hello guys

cp -a source-dir target-dir

Leave a comment

About this Entry

This page contains a single entry by Bobby published on October 17, 2004 4:34 PM.

Google Desktop was the previous entry in this blog.

The Day After Tomorrow is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

Powered by Movable Type 4.0