Skip to main content

Which cp are you using? UNIX tools are sort of similar among different systems, but may behave differently in some situations.

GNU cp has the behavior you want. BSD cp has the behavior you describe. Try removing the slash from the first argument, and writing:

cp -R /parentFolder/folder2 /parentFolder/folder1/folder1.1

rather than:

cp -R /parentFolder/folder2/ /parentFolder/folder1/folder1.1

According to wikipedia(1), this is how BSD cp does what you want.

njsg
  • 13.8k
  • 1
  • 29
  • 29