Link to home
Start Free TrialLog in
Avatar of fr33z
fr33z

asked on

Linux copy folders and subfolders

How do i copy a directory that contains files, folders, and subfolders?cp /1directory/the-files-i-want to-copy-that-contains-files-subfolders-i-need/* /destination/

thanks fr33z
Avatar of gripe
gripe

cp -r /1directory/the-files-i-want to-copy-that-contains-files-subfolders-i-need/* /destination/

ASKER CERTIFIED SOLUTION
Avatar of Mysidia
Mysidia
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi,

  "cp -r" will do the thing you want.

  However, there are some special type of files in Unix/Linux filesystem you need to
use other way.

  Most of type, I'll do the following command to include those special type of files:

tar cf - /1directory/the-files-i-want to-copy-that-contains-files-subfolders-i-need | (cd /destination ; tar xf - )


Wesly
Well, here's really no need for extra tar/untar steps to copy subdirs that may have special files.

cp -dpR  A B
is for

or (GNU-Coreutils specific)
cp -av A B

Will copy the special files around.