Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question
do a small bash script – mezgani Nov 22 '12 at 14:53
lol, this is not the question – Julio Fong Nov 22 '12 at 14:53

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


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

share|improve this answer
thank you so much – Julio Fong Nov 22 '12 at 15:47
does OP want symlinks converted into files or just ignored? – philcolbourn Apr 12 '14 at 8:04
not sure about that – Farhan Apr 13 '14 at 18:56

Or simply copy everything, then delete the symlinks.

cp -R /path/source /path/dest; find /path/dest -type l -exec rm -f {} \;
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.