2

I would like to get everything inside one directory.

How can I copy entire directory (that originally contains files and symlinks) to a new directory that should contains all files but no symlink??

Thank you

Julio Fong
  • 201
  • 1
  • 2
  • 7

2 Answers2

3

Run this command

find (Old dir) -depth -type f -o -type d | cpio -pamVd /New/Directory

it will only copy files and directories, but not symlinks

Example:

find . -depth -type f -o -type d | cpio -pamVd /root/mydir

this will recursively copy all the file/directories from current directory to /root/mydir

Farhan
  • 4,210
  • 9
  • 47
  • 76
1

Or simply copy everything, then delete the symlinks.

cp -R /path/source /path/dest; find /path/dest -type l -exec rm -f {} \;
Sammitch
  • 2,072
  • 1
  • 20
  • 34