directory linking in XP (like ln in *nix)

Discussion in 'NZ Computing' started by Adam Cameron, Sep 7, 2005.

  1. Adam Cameron

    Adam Cameron Guest

    G'day
    One can create a "hard link" to a file in XP with the FSUTIL command. But
    it doesn't seem to wrok (for me) if I try doing it with a directory.

    So am I doing something wrong, or i it a shortcoming of XP that one can
    only do this with files?

    Is there an alternative? I "know" that NTFS supports this sort of thing,
    so figure it must be possible.

    Cheers for any help.

    --

    Adam
     
    Adam Cameron, Sep 7, 2005
    #1
    1. Advertising

  2. Adam Cameron

    Mercury Guest

    You can certainly do it for folders, drives (with or ithout drive letters)
    and so on.

    The windows facility to use for directories and files is called a short cut
    (.lnk file).

    Hard links (or whatever they are called) are there in windows for posix
    compatibility reasons + 1 other specific purpose that I can't be bothered to
    recall. They are to be avoided at all costs - unless you want to crash
    backup and other apps tht aren't coded to process the inevitable circular
    references.

    Do you have a good reason for wanting one?

    "Adam Cameron" <> wrote in message
    news:...
    > G'day
    > One can create a "hard link" to a file in XP with the FSUTIL command. But
    > it doesn't seem to wrok (for me) if I try doing it with a directory.
    >
    > So am I doing something wrong, or i it a shortcoming of XP that one can
    > only do this with files?
    >
    > Is there an alternative? I "know" that NTFS supports this sort of thing,
    > so figure it must be possible.
    >
    > Cheers for any help.
    >
    > --
    >
    > Adam
     
    Mercury, Sep 8, 2005
    #2
    1. Advertising

  3. Adam Cameron

    Ralph Fox Guest

    On Thu, 8 Sep 2005 10:28:36 +1200, in message
     <>, Adam Cameron wrote:


    > Subject: directory linking in XP (like ln in *nix)
    >
    > One can create a "hard link" to a file in XP with the FSUTIL command. But
    > it doesn't seem to wrok (for me) if I try doing it with a directory.
    >
    > So am I doing something wrong, or i it a shortcoming of XP that one can
    > only do this with files?
    >
    > Is there an alternative? I "know" that NTFS supports this sort of thing,
    > so figure it must be possible.
    >
    > Cheers for any help.



    Regarding the "like ln in *nix".

    On *nix -- if it is at all possible to make a hard link to a directory,
    this may be done by the superuser only.

    I just booted up my Linux partition and tested it. Attempts to create
    hard links to directories, both as normal user and as root, failed
    with the error...

    ln: xxxxx: hard link not allowed for directory


    --
    Cheers,
    Ralph

    The early bird gets the worm, but the second mouse gets the cheese.
     
    Ralph Fox, Sep 8, 2005
    #3
  4. Adam Cameron

    Adam Cameron Guest

    > You can certainly do it for folders, drives (with or ithout drive letters)
    > and so on.
    > The windows facility to use for directories and files is called a short cut
    > (.lnk file).


    Well they're not really the same, are they?

    Sure you can double-click on a shortcut and it will be "clever" enough to
    redirect to a different file, but a shortcut - a you say - is a different
    file, not a reference to the SAME file.

    If, however, you try to do this:
    type myfile.txt

    and then:
    type "short cut to myfile.txt"

    They're plainly NOT the same file, aren't they?


    I need a reference to the *actual file* (or in this case, a directory) to
    be made in the file system. A shortcut does not effect this.


    > Hard links (or whatever they are called)


    I only mentioned HARD links cos that's all one can do with FSUTIL. A
    symbolic link would be fine.

    Something like what one gets as a result of:

    ln -s someDirectory nameOfLinkToSaidDirectory

    > are there in windows for posix
    > compatibility reasons + 1 other specific purpose that I can't be bothered to
    > recall.


    Funny thing to say.

    > They are to be avoided at all costs


    I haven't used *nix that much, but I have always found them jolly useful,
    and fairly worry free. But that could be my ignorance of "the bigger
    picture" talking.

    >- unless you want to crash
    > backup and other apps tht aren't coded to process the inevitable circular
    > references.


    *I guess*. I'm not trying to overthrow the internet with the evils of my
    overly complex file system trickery, I just wanna have a subdirectory show
    up in two different places.

    > Do you have a good reason for wanting one?


    Yep. Like I said: I need a file (the *same* *file*) to be present in more
    than one place.

    --
    Adam
     
    Adam Cameron, Sep 9, 2005
    #4
  5. Adam Cameron

    Adam Cameron Guest

    >> Subject: directory linking in XP (like ln in *nix)
    >>
    >> One can create a "hard link" to a file in XP


    > Regarding the "like ln in *nix".
    >
    > On *nix -- if it is at all possible to make a hard link to a directory,
    > this may be done by the superuser only.



    Sorry, yeah: my wording was unclear. I want to effect the same thing that
    you can with ln on *nix, and the closest I've found in XP is the hardlink
    option - for files - in fsutil. The two statements were not supposed to be
    taken as contiguously as they seem to have been.

    I don't need a hardlink. A symbolic one is fine. See my response to
    "Mercury" for (a bit) more detail.

    --
    Adam
     
    Adam Cameron, Sep 9, 2005
    #5
  6. In article <dfp11u$igu$>, "Mercury" <>
    wrote:

    >You can certainly do it for folders, drives (with or ithout drive letters)
    >and so on.
    >
    >The windows facility to use for directories and files is called a short cut
    >(.lnk file).


    But a .lnk file would have to be interpreted by the Windows Explorer
    when the user double-clicks on it--it's not built-in at the filesystem
    level.

    I think the OP wants something supported at the filesystem level, so
    it's transparent to applications.
     
    Lawrence D¹Oliveiro, Sep 9, 2005
    #6
  7. Adam Cameron

    Tim Guest

    > Yep. Like I said: I need a file (the *same* *file*) to be present in more
    > than one place.



    That answer begs all sorts of questions. IE To start off with Why? Why are
    you one of the few people in the world that wants this facility when
    clearly, there are many advanced users (of many OS) that have a solution as
    if they didn't have one to their problem and it were common, someone would
    provide the solution. IE I see it as a forgone conclusion that most of what
    people want to do on OS can already be done because to imagine a solution
    like so requires you to be in a context that is bound to have been explored
    many times by many other people.

    Clarify what you are trying to do and I have no doubt that you can eliminate
    the need for the hardlink and find a good working alternative that is OS
    supported, recommended, and works like a charm.
     
    Tim, Sep 10, 2005
    #7
  8. In article <dft77p$a6q$>, "Tim" <>
    wrote:

    >> Yep. Like I said: I need a file (the *same* *file*) to be present in more
    >> than one place.

    >
    >That answer begs all sorts of questions. IE To start off with Why?


    Obviously you don't use an OS where you can take a facility like that
    for granted.
     
    Lawrence D¹Oliveiro, Sep 10, 2005
    #8
  9. Adam Cameron

    Adam Cameron Guest

    > That answer begs all sorts of questions. IE To start off with Why? Why are
    > you one of the few people in the world that wants this facility when
    > clearly,


    "clearly"? I imagine most of the demographic you describe have just
    written off the Windows Shell as a joke, years ago, so never bother trying.
    This is what I generally do.


    > there are many advanced users (of many OS)


    Heh. Well - like I said - on *nix-based OSes it's one simple command. The
    shortcoming is in the Windows shell (not even one of NTFS, just of Windows'
    access to NTFS's functionality).


    > that have a solution as
    > if they didn't have one to their problem and it were common, someone would
    > provide the solution.


    So if it is not an issue, how come NTFS supports it?


    > IE


    BTW, you mean "EG", but hey.

    > I see it as a forgone conclusion that most of what
    > people want to do on OS can already be done because to imagine a solution
    > like so requires you to be in a context that is bound to have been explored
    > many times by many other people.


    That doesn't make any sense.

    > Clarify what you are trying to do and I have no doubt that you can eliminate
    > the need for the hardlink and find a good working alternative that is OS
    > supported, recommended, and works like a charm.


    Why don't you just say "sorry, don't know: not sure that it can be done",
    or simply not reply to the thread?

    But as two people have asked, here's the story.

    I have some software (which I am part of the development team of).

    Now. Our software needs to run atop of two versions of its application
    server (ColdFusionMX, 6.1 and 7), each of which in this situation are
    running in two separate instances, serving up two different webroot
    directories. I could set both of them to serve the same directory, which I
    might do, but this whole question has got me thinking, so I want to follow
    it through. It'd also be good knowledge to have for other situations
    without the easy work-around.

    It would be *really* *convenient* for me if I could link the same one
    project directory into each of those two webroots. It would be verty easy
    for me to run different copies and just update one or the other every now
    and then - which is what I usually do - but it would just be *more*
    *convenient* for me to have the link. It's not practical to hardlink every
    file in the project, because there are thousands of them, and it just
    seems too much like using a hammer to crack a walnut.

    Given the file system (NTFS) supports hardlinking of file, I suspect it
    probably also supports symbolic linking; just that Windows hasn't got
    around to adding it to it's CLI. So I figured it could well be possible to
    [somehow] talk straight to NTFS to effect the results that I wanted, and
    that some clever bod wouldhave worked out how.

    If it was an option, I'd shift this phase of testing to a *nix box, but
    it's not practical at this point.


    Finally, how about we all make a deal:

    How about we stipulate "Odds-on people reading this thread don't know the
    answer to the question". If you're reading this, and fall into that group,
    don't feel bad, but equally, don't feel compelled to post a response
    anyhow. This stipulation could be applied to most situations in Usenet,
    and indeed life, now that I think about it.

    And how about we also stipulate that if you're response is going to end up
    seeming like it was delivered from a soap box at the front of Room 1 at
    some primary school for linguistically-challenged Windows yea sayers,
    then... equally, don't feel compelled to press "send". Type it in, rub
    your crotch to your "heart's" content, and then press Cancel. You'd be
    doing everyone a favour.

    Now... anyone know the actual answer? I've been doing some more research
    into this, and yes: NTFS *does* support symbolic links. In NTFS parlance,
    they are called "junctions". And what I am currently reading observes the
    same a I have: NTFS supports them, Windows gives you no access to them. But
    where there's a will...

    Cheers.

    --

    Adam
     
    Adam Cameron, Sep 11, 2005
    #9
  10. Adam Cameron

    Adam Cameron Guest

    SOLUTION: directory linking in XP (like ln in *nix) (was: directory linking in XP (like ln in *nix))

    Hi.
    Once I found out that the term I was looking for in NTFS was not "symbolic
    link" it was "junction", I found the (well: "an") answer quite quickly:

    http://www.sysinternals.com/Utilities/Junction.html

    Cheers to those who took time to respond to my question, whether it was
    trying to be helpful or... otherwise.

    --

    Adam
     
    Adam Cameron, Sep 11, 2005
    #10
  11. Adam Cameron

    Shane Guest

    Shane, Sep 11, 2005
    #11
  12. Adam Cameron

    Adam Cameron Guest

    Adam Cameron, Sep 11, 2005
    #12
  13. Adam Cameron

    Mercury Guest

    Re: SOLUTION: directory linking in XP (like ln in *nix)

    If you read the docs, you will see that has been supported in NTFS since v4,
    but as I said it is not something you should not do without awareness, a
    solid reason, and the reasons of: fowling up s/w that does directory
    recursion (circular references), it is obscure, and can lead to corrrupt
    data / missing files (by users forgetting that it is a hardlink). I suggest
    you do a trial run of whatever backups s/w you have to ensure the junction
    point does not cause it to go into a loop - because that is what you are
    creating.

    One of the supported commands is linkd in the W2K resource kit.

    Due to the number of dicky "Linux can do this (odd thing) can Windows?"
    style questions that appear in this ng, I don't make it a habit of splashing
    out how to's on things that are not advisable. Your explanation was
    plausible sort of - I still would (and advise to) solve the issue using an
    alternative technique esp. since you indicate your company is the s/w
    author.




    "Adam Cameron" <> wrote in message
    news:14m82letj5h04$...
    > Or better, the official solution!
    > http://support.microsoft.com/default.aspx?scid=kb;EN-US;q205524
    >
    > So I have to take it back that there was no native Windows support for it.
    > I mut have been running off bad / out-of-date information.
    >
    > --
    >
    > Adam
     
    Mercury, Sep 11, 2005
    #13
  14. Re: SOLUTION: directory linking in XP (like ln in *nix)

    In article <dg0j3o$l2p$>, "Mercury" <>
    wrote:

    > ... it is not something you should not do without awareness ...


    All Dimdows users listen up!
     
    Lawrence D¹Oliveiro, Sep 11, 2005
    #14
  15. Adam Cameron wrote:
    >>>Subject: directory linking in XP (like ln in *nix)
    >>>
    >>>One can create a "hard link" to a file in XP

    >
    >
    >>Regarding the "like ln in *nix".
    >>
    >>On *nix -- if it is at all possible to make a hard link to a directory,
    >>this may be done by the superuser only.

    >
    >
    > Sorry, yeah: my wording was unclear. I want to effect the same thing that
    > you can with ln on *nix, and the closest I've found in XP is the hardlink
    > option - for files - in fsutil. The two statements were not supposed to be
    > taken as contiguously as they seem to have been.
    >
    > I don't need a hardlink. A symbolic one is fine. See my response to
    > "Mercury" for (a bit) more detail.


    True symbolic links aren't supported on XP - they are new to Longhorn.
    You can create a directory junction between the two.
    Fsutil doesn't support creating directory junctions, but the tool
    linkd.exe does. This tool is in the Windows Resource Kit.
     
    Nathan Mercer, Oct 5, 2005
    #15
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. J Bard
    Replies:
    2
    Views:
    4,031
    J Bard
    Jan 10, 2004
  2. NeoMaxiZoomDweeby

    Stores Nix Disposable Flicks

    NeoMaxiZoomDweeby, Feb 2, 2004, in forum: DVD Video
    Replies:
    1
    Views:
    355
    Scot Gardner
    Feb 2, 2004
  3. Scoresby

    Question for nix users

    Scoresby, Nov 9, 2006, in forum: Computer Support
    Replies:
    18
    Views:
    726
  4. nobody >
    Replies:
    4
    Views:
    4,746
    Plato
    Jan 5, 2008
  5. Lawrence D¹Oliveiro

    Why no *nix Hackers Named Neville

    Lawrence D¹Oliveiro, Aug 12, 2005, in forum: NZ Computing
    Replies:
    3
    Views:
    312
    Dorado
    Aug 14, 2005
Loading...

Share This Page