Folder1/ -fileA.txt -fileB.txt -fileC.txt > mkdir Folder2/ > [copy command]
And now Folder2/
looks like:
Folder2/ -fileA.txt -fileB.txt -fileC.txt
How to make this happen? I have tried cp -r Folder1/ Folder2/
but I ended up with:
Folder2/ Folder1/ -fileA.txt -fileB.txt -fileC.txt
Which is close but not exactly what I wanted.
Thanks!
In order to copy a directory on Linux, you have to execute the “cp” command with the “-R” option for recursive and specify the source and destination directories to be copied. As an example, let's say that you want to copy the “/etc” directory into a backup folder named “/etc_backup”.
To copy multiple files with the “cp” command, navigate the terminal to the directory where files are saved and then run the “cp” command with the file names you want to copy and the destination path.
Copy a Directory and Its Contents ( cp -r ) Similarly, you can copy an entire directory to another directory using cp -r followed by the directory name that you want to copy and the name of the directory to where you want to copy the directory (e.g. cp -r directory-name-1 directory-name-2 ).
Try this:
cp Folder1/* Folder2/
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