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.
To do this, click and hold your left mouse button on the top-left portion of where you want to start highlighting. Next, drag the box until the last file or folder is highlighted. Once the files are selected, they can be copied, cut, or dragged to another window to move them.
If you need to copy a file to multiple folders, you can hold down the Ctrl key, and drag the file or folder on to each folder you want to copy it to.
The another way to copy files to multiple locations is by using echo , xargs and cp commands. As you already know, the cp command is used to copy the files and directories, and xargs command is used to build and execute command lines from standard input.
Copy Multiple Files Using CP CommandYou must provide both the file name and the destination directory when using the cp command to copy multiple files. First, open the specific directory in the terminal and execute the tree command. If you don't know about the tree command, then please check out this blog.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With