FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Gentoo > Gentoo User

 
 
LinkBack Thread Tools
 
Old 08-10-2010, 09:06 PM
Jarry
 
Default How can I create "dynamic" link?

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.
 
Old 08-10-2010, 09:56 PM
Nikos Chantziaras
 
Default 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.
 
Old 08-10-2010, 10:09 PM
Bill Longman
 
Default 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."
 
Old 08-10-2010, 10:18 PM
Lanikai
 
Default 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.
 
Old 08-11-2010, 03:12 AM
Grant Edwards
 
Default 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
 
Old 08-11-2010, 06:54 AM
Alan McKinnon
 
Default 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.


--
alan dot mckinnon at gmail dot com
 

Thread Tools




All times are GMT. The time now is 06:43 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org