Melodie Gauthier
Melodie Gauthier

Reputation: 715

Bash Copy folder content, not folder

I would like to copy the contents of a folder to another one, without copying the actual folder itself. For example, in /dirA/dirB/ I have a.txt, b.txt and c.txt. I would like to do:

cp -r /dirA/dirB/ /some/folder/

In a way that a.txt, b.txt and c.txt are in /some/folder, not in /some/folder/dirB

Upvotes: 0

Views: 173

Answers (1)

Jonathan Leffler
Jonathan Leffler

Reputation: 753675

cp /dirA/dirB/*.txt /some/folder

will do that, avoiding the -r option.

Upvotes: 5

Related Questions