I'm trying to copy the current directory as a source. Using full paths gives me the expected behaviour, copying the entire directory into the destination.
$ cd /tmp
$ mkdir a b
$ cd a
$ touch 1 2 3
$ cp -r /tmp/a /tmp/b # use /tmp/a as source
$ ls /tmp/b
a
However, using .
to refer to the source copies the contents of the source instead of the directory itself.
$ cd /tmp
$ mkdir c
$ cd a
$ cp -r . /tmp/c # use . as source
$ ls /tmp/c
1 2 3
What is the difference between .
and the absolute path of the current directory? If I want to copy the current directory itself, is there a short reference? (The only way I could see was to use ../a
, which seems slightly redundant.)
.
would still have the same result. e.g./path/to/custom/ping
vs../ping
.