I am using the cp command in a bash script for data management purposes where I need directories to be recursively copied from one location to another. As it is very important that my script would give me the correct behavior I am double checking all the commands and flags that I am using. To this extend I was reading the Man page of the cp command where the recursive copying options are described as follows:
-r: copy recursively, non-directories as files
-R, --recursive: copy directories recursively
As I understand, recursive copying means that the content of a directory and all its subdirectories are copied as well. Does -R not copy subdirectories and content? What is the difference between both options?
I have used -r in previous scripts which always worked as intended, but I'm curious to the difference as -R might be more appropriate in future cases.
Based on man page both option does the same operation.
https://man7.org/linux/man-pages/man1/cp.1.html