Suppose I have a file system like this:
/home/me/dir1/dir2/dir3/dir4/dir5/dir6/file1
Then in /home/me/dir1
, I create a symbolic link:
$ cd /home/me/dir1
$ ln -s /home/me/dir1/dir2/dir3/dir4/dir5/dir6 linkdir6
I am trying to copy file1 to my home directory (this is my simplified example, it's more complicated than this - "/home/me/" is actually a much more complicated directory structure, so "~/" is not a solution).
$ cd linkdir6
$ cp file1 ../
$ cd ..
$ ls
dir2 linkdir6
I don't see file1. Searching for it, I find it in /home/me/dir1/dir2/dir3/dir4/dir5/file1
It seemed cp
didn't realize it was inside a symbolic directory.
How do I cp
out of a symbolic folder?
Or, how do I make cp
understand that ../
should be dereferenced (where dest in the man page is deferenced)?
Am I missing something? Is this even possible?
Thanks!
(final note - the actual use case is in a deep directory structure, inside one symlink directory, trying to copy a file ../another-symlink-directory/ without typing complete paths - that's one of the points of symbolic links as far as I'm concerned)
file1
in/home/me/dir1
? – Arkadiusz Drabczyk Apr 16 '20 at 16:57