How to copy with cp to include hidden files and hidden directories and their contents?

Posted by eleven81 on Super User See other posts from Super User or by eleven81
Published on 2009-10-27T19:46:06Z Indexed on 2010/04/23 12:33 UTC
Read the original article Hit count: 268

Filed under:
|
|
|
|

How can I make cp -r copy absolutely all of the files and directories in a directory

Requirements:

  • Include hidden files and hidden directories.
  • Be one single command with an flag to include the above.
  • Not need to rely on pattern matching at all.

My ugly, but working, hack is:

cp -r /etc/skel/* /home/user
cp -r /etc/skel/.[^.]* /home/user

How can I do this all in one command without the pattern matching? What flag do I need to use?

© Super User or respective owner

Related posts about cp

Related posts about recursive