Re: [SLUG] Linking Directories

From: R.G. Mayhue (rmayhue@tampabay.rr.com)
Date: Sun Apr 17 2005 - 12:38:21 EDT


On Sunday 17 April 2005 09:56 am, SOTL wrote:
>
> Hi All
>
> From discussions I has at the last Dunedial meeting I thought links were
> simple but I have found differrent.
>
> I have a copy O\of O'Reilly Pocket Guide to Linux and a copy of Practical
> Linux but neither appear to discuss what I would like to do.
>
> Lets assume I have a file: testfile1
> I can link test1 to a secton file called testfileln1 by
> $ ln -s testfile1 testfileln1
>
> well and good.
>
> But what I would like to do is do this with with two directories say
> testdir1 and testdir2.
>
> Lets let testdir1 contains files testfile1 and testfile2.
> Now I would like to link testdir1 to testdir2 so that all files in testdir1
> appear in testdir2. That is when I open testdir2 I see all the files in
> testdir1.
>
> I would appreciate someone explaining how one does that.
>
> Thanks
> Frank

Hi Frank,

The command for creating symbolic links to directories works the same as it
does for files. Using your testdir example you would do:

$ ln -s testdir1 testdir2

That would create a symbolic link named "testdir2" pointing to "testdir1".

The following example should illustrate what you want to do.

$ mkdir testdir1
$ cd testdir1
$ echo "This is the contents of testfile1" > testfile1
$ ln -s testfile1 testfile2
$ cd ..
$ ln -s testdir1 testdir2
$ cat testdir2/testfile2

The cat commend will print:
$ This is the contents of testfile1

-Rob

-----------------------------------------------------------------------
This list is provided as an unmoderated internet service by Networked
Knowledge Systems (NKS). Views and opinions expressed in messages
posted are those of the author and do not necessarily reflect the
official policy or position of NKS or any of its employees.



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 17:43:20 EDT