Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Copy .git folder terminal with copy all

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:

  • cp command should ignore some files
  • How to use 'cp' command to exclude a specific directory?
  • https://unix.stackexchange.com/questions/91022/copy-all-dotfiles-except-for-git-and

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.

like image 519
Numerials Avatar asked Jun 01 '26 22:06

Numerials


1 Answers

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.

like image 81
1615903 Avatar answered Jun 04 '26 23:06

1615903



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!