Hi,
I am facing this problem: I have subdirectory, let's say
"/some/dir". I would like to create some kind of "dynamic"
and "preliminary" link, so that any future subdirectories,
created later in /some will in fact be links, pointing to
/some/dir.
So if later any user does:
cd /some
mkdir whatever
There should not be subdirectory /some/whatever, but actually link:
/some/whatever -> /some/dir
Is it possible?
Jarry
--
__________________________________________________ _____________
This mailbox accepts e-mails only from selected mailing-lists!
Everything else is considered to be spam and therefore deleted.
08-10-2010, 09:56 PM
Nikos Chantziaras
How can I create "dynamic" link?
On 08/11/2010 12:06 AM, Jarry wrote:
Hi,
I am facing this problem: I have subdirectory, let's say
"/some/dir". I would like to create some kind of "dynamic"
and "preliminary" link, so that any future subdirectories,
created later in /some will in fact be links, pointing to
/some/dir.
So if later any user does:
cd /some
mkdir whatever
There should not be subdirectory /some/whatever, but actually link:
/some/whatever -> /some/dir
Is it possible?
mkdir creates directories, not links. You need to do "ln -s /some/dir
/some/whatever". Having mkdir create links would be a bug.
08-10-2010, 10:09 PM
Bill Longman
How can I create "dynamic" link?
On 08/10/2010 02:06 PM, Jarry wrote:
> Hi,
> I am facing this problem: I have subdirectory, let's say
> "/some/dir". I would like to create some kind of "dynamic"
> and "preliminary" link, so that any future subdirectories,
> created later in /some will in fact be links, pointing to
> /some/dir.
>
> So if later any user does:
> cd /some
> mkdir whatever
>
> There should not be subdirectory /some/whatever, but actually link:
> /some/whatever -> /some/dir
>
> Is it possible?
Unless you write your own kernel module, the answer is "No."
08-10-2010, 10:18 PM
Lanikai
How can I create "dynamic" link?
On 08/10/2010 11:06 PM, Jarry wrote:
Hi,
I am facing this problem: I have subdirectory, let's say
"/some/dir". I would like to create some kind of "dynamic"
and "preliminary" link, so that any future subdirectories,
created later in /some will in fact be links, pointing to
/some/dir.
So if later any user does:
cd /some
mkdir whatever
There should not be subdirectory /some/whatever, but actually link:
/some/whatever -> /some/dir
Is it possible?
Jarry
Hello,
this is probably not an answer for your question but... You can achieve
this in different way - write small script and after this use some
program (for example cron) which will execute that script every few
seconds/minutes. The script may remove every empty directory located in
/some (excluding /some/dir) and create a link to it.
Regards, Paul.
08-11-2010, 03:12 AM
Grant Edwards
How can I create "dynamic" link?
On 2010-08-10, Jarry <mr.jarry@gmail.com> wrote:
> I am facing this problem: I have subdirectory, let's say
> "/some/dir". I would like to create some kind of "dynamic"
> and "preliminary" link, so that any future subdirectories,
> created later in /some will in fact be links, pointing to
> /some/dir.
Short answer: you can't do that.
Long answer: tell us what problem you're really facing (for which you
think "dynamic link" is a solution), and we'll try to help you solve
it.
--
Grant
08-11-2010, 06:54 AM
Alan McKinnon
How can I create "dynamic" link?
On Wednesday 11 August 2010 00:09:13 Bill Longman wrote:
> On 08/10/2010 02:06 PM, Jarry wrote:
> > Hi,
> > I am facing this problem: I have subdirectory, let's say
> > "/some/dir". I would like to create some kind of "dynamic"
> > and "preliminary" link, so that any future subdirectories,
> > created later in /some will in fact be links, pointing to
> > /some/dir.
> >
> > So if later any user does:
> > cd /some
> > mkdir whatever
> >
> > There should not be subdirectory /some/whatever, but actually link:
> > /some/whatever -> /some/dir
> >
> > Is it possible?
>
> Unless you write your own kernel module, the answer is "No."
The slightly longer answer is that the idea, as presented, is stupid. Looks
like a foolish grasp at a "solution" for a "problem".
If the OP wants a link in /some/ he needs to make one using ln
If the OP wants a subdir in /some/ he needs to make one using mkdir
There is no magic way to turn one into the other because they are different.
It appears to me that he finds things like /some/otherdir/ that should never
have been created at all and their contents should have gone into /some/dir/
instead. There's an easy solution to that:
remove write permission from /some/ and add it to /some/dir/ for all users
that write to /some/dir/. They can't create the wrong directories without
permissions.