3

In Linux shell, How can I copy all files from /folder into /folder/sub?

the normal way of copying recursively isn't working (which makes sense) because i'm copying a folder into itself...

LtWorf
  • 6,904
  • 5
  • 30
  • 41
d-_-b
  • 19,976
  • 37
  • 134
  • 224

1 Answers1

2
cp -a !(sub) sub

You can exclude the sub directory.

From the comments on that similar question:

If this doesn't work, you might need to enable:

shopt -s extglob
Community
  • 1
  • 1
Shawn Balestracci
  • 7,150
  • 1
  • 30
  • 51