2

I'm trying to use cp to copy all files from sub-folder to current folder in zsh on osx. I basically want to have the problem these people are trying to get around:

I want the opposite. When I copy files, my .git folder is NOT being copied along with the rest of the files.

I've tried the following to no avail:

cp -RLv fetch/* ./
cp -RL fetch/* ./
cp -Rv fetch/* ./
cp -R fetch/* ./
cp -rv fetch/* ./
cp -r fetch/* ./
cp fetch/* ./

Is this possible? I'm okay with using mv too if I have to.

Community
  • 1
  • 1
Numerials
  • 37
  • 1
  • 4

3 Answers3

9

The correct command is cp -r fetch/. ./

Asterisk (*) doesn't work because it is extended by the shell, and by default it doesn't include dotfiles/directories.

1615903
  • 32,635
  • 12
  • 70
  • 99
1

try this?

cp -a fetch fetch-copy

fun
  • 21
  • 1
0

On a Linux system:

cp -rT fetch .

I believe on BSD this would work:

cp -R fetch/ .
xpusostomos
  • 1,309
  • 11
  • 15