2

This command wont copy .htaccess files:

cp -Rdfp $source/* $dest/ 

Thanks

SexyMF
  • 195
  • The problem is, that the wildcard (*) does not expand to hidden files (starting with .) by default. You should check the question from my previous comment for possible solutions. – Wayne_Yux Jun 17 '16 at 14:33

1 Answers1

5

In bash, the * glob doesn't include hidden files ('dotfiles') by default - you can enable that explicitly by setting the dotglob shell option e.g.

shopt -s dotglob
cp -Rdfp $source/* $dest

You can unset the option after with shopt -u dotglob.

Alternatively, if $dest does not already exist, the much simpler

cp -Rdfp $source $dest

(avoiding the glob altogether) should work as well.

steeldriver
  • 136,215
  • 21
  • 243
  • 336