Sometimes it's useful to copy a directory that contains symlinks. The default cp behaviour is to follow the symlink and copy the file the symlink points to. If you want to preserve the symlinks as symlinks, then the flags the cp command uses depends on the operating system:
Solaris 10 and Linux:
$ cp -rP dir1/* dir2
The -r is recursive (in case dir1 has subdirectories) and the -P preserves the symlink.
AIX 5.2:
$ cp -rh dir1/* dir2
The -r is the same as Solaris, the -h preserves the symlink.
No comments:
Post a Comment