Copy the target from a symlink?
I have a directory of symlinked files. I want to grab a copy of all the target files while retaining their original filename and not the one assigned to it by the symlink.
I have a directory full of symlinks such as:
aaa.jar -> release/25-may-2006/aaa.jar.7
I wish to get a copy of aaa.jar.7.
If I use the normal cp command I can get the file called aaa.jar which will be the same as aaa.jar.7. However, I wish to get a copy of the target while keeping the original name (aaa.jar.7 in this case).
How can I do this?
You use the readlink command to get the name of the target. The result contains the path to the link, so if you just want the filename (not the full path), you need to remove anything preceeding the last /. You might use it like this.
|All times are GMT -5. The time now is 03:09 PM.|