Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

Is there any way to copy multiple directories in one command, to reduce the number of layers? E.g., instead of:

COPY dirone ./dirone
COPY dirtwo ./dirtwo
COPY dirthree ./dirthree

I want to do:

COPY dirone/ dirtwo/ dirthree/ ./

However, this copies the contents of the directories... but I want to copy the directories themselves.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
2.2k views
Welcome To Ask or Share your Answers For Others

1 Answer

That's the documented behavior of the copy command:

If <src> is a directory, the entire contents of the directory are copied, including filesystem metadata.

Note: The directory itself is not copied, just its contents.

Best workaround I can suggest is to change your directory layout in your build folder, move the three folders under one parent folder and add the parent.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share

548k questions

547k answers

4 comments

86.3k users

...