Fred Stluka on 14 Dec 2016 15:13:04 -0800


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] Symlink Problem


Casey,

You've ended up with a /docs directory containing a document
symlink, instead of just a /docs symlink.  That's exactly what
happens if you already had a /docs directory when you executed
the command:
    ln -s /files/document /docs
because the ln command checks to see whether the 2nd argument
already exists as a directory and if so it creates a link with the same
name as the target file ("document" in this case).

I make that mistake pretty often.

My solution would be:
    rm /docs/document
    rmdir /docs
    ln -s /files/document /docs

--Fred
------------------------------------------------------------------------
Fred Stluka -- mailto:fred@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.
------------------------------------------------------------------------

On 12/14/16 2:52 PM, Casey Bralla wrote:
OK, here's a VERY simple problem that has me flummoxed.


I've mounted my files (which are stored on a separate partition) as /"files".
Within that directory, I have my documents stored in directory
"/files/document".


Typing "/files/document" is too long, so I wanted to get a shortcut to it.  I
therefore want to create a simple symlink to that directory with a simple,
short directory.  I've created a directy "/docs" and am trying to symlink it
to "/files/document"


I executed: "ln -s "/files/document /docs" to create the symlink.  But when I
do a listing of "/docs", I get this:

#ls -lap /docs
total 8
drwxr-xr-x  2 root root 4096 Dec 14 14:44 ./
drwxr-xr-x 29 root root 4096 Dec 14 14:43 ../
lrwxrwxrwx  1 root root   15 Dec 14 14:44 document -> /files/document



If I list the "/docs/document" directory, I get all my documents listed as I
expected.


Can somebody explain to me what I'm doing wrong?   It all seems so simple, but
I'm screwing it up somehow.

TIA!

___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug