Let me explain my problem with a simpler scenario. We have these two directories: ~/Foo
and ~/Bar
. Foo contains the files test1.txt
and test2.txt
. If I run the command cp -R Foo Bar
, the Bar directory now contains a Foo folder containing the two text files. However, if I run the command cp -R Foo Bar
when the Bar
directory does not yet exist before the command is run, the newly created Bar
directory will not contain a Foo
subdirectory but only the two .txt
files.
Why is it when I run the command in the first situation that it creates a subdirectory with the two files but in the second situation it just copies the two files into the new directory? Is the cp
program supposed to function in this way?