on a directory cp -rvf dir .
copies the symbolic links and not actual contents. src is copied to module/hal/
. |-- comm | `-- alchemist.c |-- module | `-- hal | `-- src | `-- comm -> ../comm `-- src `-- comm -> ../comm
Copying Directories with cp Command To copy a directory, including all its files and subdirectories, use the -R or -r option.
The symbolic link does not contain any data, but you can perform all operations on the symbolic link file. Removing a symbolic link does not delete the original file, but deleting a file makes the symlink a dangling link.
Use cp -P (capital P) to never traverse any symbolic link and copy the symbolic link instead. This can be combined with other options such as -R to copy a directory hierarchy — cp -RL traverses all symbolic links to directories, cp -RP copies all symbolic links as such.
As we know, cp copies the symbolic links (symlinks) in the source directory as symlinks to the destination directory.
From cp(1)
:
-L, --dereference always follow symbolic links in SOURCE
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