I know that the dirs ~/foo and ~/bar already exist.
I know that "cp -R ~/foo ~/bar" will recursively copy the ~/foo directory into the ~/bar directory, potentially causing ~/bar/foo to be created.
But what if foo is a symlink to a directory? Can I make the cp command copy the directory that the symlink points to, instead of the symlink itself?
Because with the above command, if foo is a symlink, then ~/bar/foo will actually be just a symlink.
From man cp
:
-L, --dereference
always follow symbolic links in SOURCE
Use -L option like this:
cp -RL ~/foo ~/bar
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With