NAME

unln - Convert a symbolic link to a copy of its target


SYNOPSIS

unln -rshlopR file ...


DESCRIPTION

For each symbolic link given by file, convert it to a copy of its target as follows:

If any specified file is not a symbolic link, then a warning is issued and a status of 1 is returned, unless file is a directory and the -R option is specified.

If expanding the link would result in a tree of infinite size because it contains a link to a parent directory, then such links are expanded only once, a warning is issued, and a status of 1 is returned. If a link cannot be expanded because it is self-referential, then it is not modified, a warning is issued, and a status of 1 is returned.

If -o is specified and neither -l nor -p is specified, then the modifications of the filesystem made by this program, if successful, are semantically imperceptable until a modification is made either through the source or to the target of the original symbolic link, except that the filesystem utilization is affected, the results of lstat(2) and readlink(2) might be different, the dev, ino and ctime results of stat(2) might be affected, and the directory obtained by appending /.. to the source of the link might be different. (There are probably a few other ways to tell the difference, but you get the idea.)


OPTIONS

-r
If the result after expansion is a directory, then recurse on each of the directory's entries. Use this option to copy the entire tree (with symbolic links intact unless -h is specified).

If in the process of expanding the tree we discover a relative symbolic link whose target is unambiguously within the same tree, then that link is expanded as the corresponding node in the source tree rather than the target tree. In some cases, this makes the source tree independent of the target tree, such that the target tree can be safely removed.

-s
Similar to -r, except that expansion continues only on entries that point to a directory. If -h is specified, then expansion will continue on entries that point to a symbolic link to a directory as well. Use this option to create a shadow directory. Supercedes -r.

-h
If the result after expansion is a symbolic link, then keep expanding it until it can't be expanded any more.

-l
If the target is a relative symbolic link, then copy the link as-is. This is useful when you know there is a copy of that link's target relative to the source directory. Supercedes -h.

-o
Attempt to make the owner and group match the target. This is likely to fail unless run as super user.

-p
If the target is a fifo (a.k.a pipe), then replace it with a new fifo. Like the -l option, this might cause the semantics of the filesystem to change, because a write to one fifo will not be read by the other. However, it's probably what you want if you're going to remove the target.

-R
For any file that is an actual directory, perform the sepcified operation on every symbolic link within the directory tree.


BUGS

If the program is interrupted or fails, then it will most likely leave behind a copy of its completed work in a file with a random suffix. This is probably a good thing because it might help you to figure out exactly what went wrong. However, it would be better if a message were generated to let you know what was left behind.