I've tested the cp
command, and it will only copy individual files. For example, I typed cp
followed by the exact filename, then typed the directory and the file got copied. However, when I typed the directory and the destination directory, nothing on the computer changed. I thought cp
was supposed to copy contents in the directories.
I've tried this multiple times.
When you use cp without any arguments, it defaults to copying files as below
But if you want to copy a directory, you need to specify the recursive argument like this
Ideally you can specify as many files as you want to a single destination all separated by spaces. This here below however copies a dir along with its permissions
Alternatively you can use rsync
And Please don't forget the trailing slashes when copying using rsync. See the man page for each command on options of using them available on your terminal by typing man cp or man rsync
Use
It specifies recursive copy i.e. all sub-directories and files will be copied. Use
man cp
to find more switches for cp.cp
does not, by default, copy directories. Fromman 1posix cp
:You should have got a message like so:
For example:
As can be seen from the manpage, use
-r
or-R
withcp
: