Consider cp a b/c
.
If c
doesn't exist (and b
does), it will be interpreted as a name for the copy of a
, so you will end with b/c
.
On the other hand if c
does exist and it's a directory, it will be interpreted as a path where to place a
under the unchanged name a
, so you will end with b/c/a
.
I guess in the beginning /home/jake/project/__workspace/scalaProjects/scalaML/src/main/scala
doesn't exist, there's only /home/jake/project/__workspace/scalaProjects/scalaML/src/main/
.
Your first command creates scala
acting as (1). It may be somewhat confusing because you have scala
in place of a
and c
, so it's not obvious that some trivial renaming takes place (from scala
to scala
). Then the second command acts as (2).
This command will work as your first one, regardless if the target scala
exists, if only /home/jake/project/__workspace/scalaProjects/scalaML/src/main/
exists:
cp -av /home/jake/transit/scalaProjects/scalaML/src/main/scala /home/jake/project/__workspace/scalaProjects/scalaML/src/main/
But if /home/jake/project/__workspace/scalaProjects/scalaML/src/main/
doesn't exist and /home/jake/project/__workspace/scalaProjects/scalaML/src/
does, your scala
will be placed there under the name main
. This is behavior (1) again.
To get rid of this ambiguity use -t
:
cp -av /home/jake/transit/scalaProjects/scalaML/src/main/scala -t /home/jake/project/__workspace/scalaProjects/scalaML/src/main/
This makes cp
interpret main
as a directory where you want to place scala
. No renaming will take place. If /home/jake/project/__workspace/scalaProjects/scalaML/src/main/
doesn't exist, cp
will throw an error.
Look at the source directories - I suspect you will find that all the code is in .../test/scala/scala – davidgo – 2018-02-15T09:49:54.030