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
  • 7,286
  • 6
  • 31
  • 45
d-_-b
  • 21,536
  • 40
  • 150
  • 256

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,380
  • 1
  • 34
  • 52