Given this configuration :
../dir1/file1
../dir2/link-to-file1
../dir2/fileX
And I want to copy fileX to ../dir1/file1, but if I go:
dir2$ cp fileX file1
then
dir2/file1 is no longer a link to file1 so that file1 and fileX are different files.
Is there a cp option to do that, or do I need to use some other operation.
UPDATE
In dir2
dir2$ ln -s ../dir1 (this creates link to dir1)
dir2$ cp fileX dir1
But is there a way of copying to the file through the link to the file?
linkedir/file1link-to-file1a symbolic link or a file? Could you showls -l-like directory listings or something created bytreeinstead. Can you show the situation that you have, the situation you want, and what you are currently getting? Are hard links ever involved in your question?