forums Computer Tutorials Computer Help and Spyware Removal File DatabaseUninstall Database Windows Startup Programs Database Computer Resources Computer Glossary Forums Computer Help and Spyware Removal
 

Welcome Guest ( Log In | Click here to Register a free account now! )



Register a free account to unlock additional features at BleepingComputer.com
Welcome to Bleeping Computer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.
Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

 
Reply to this topicStart new topic
> Unbreakable Shortcuts, The Little known hard link
Amazing Andrew
post Dec 29 2007, 04:24 PM
Post #1


Bleepin' Night Watchman
******

Group: BC Advisor
Posts: 1,762
Joined: 5-December 05
From: The City of Saint Francis, by the western sea
Member No.: 43,307



I'm sure you've had this happen before: you double click on a shortcut and Windows balks at you because the target has moved.

Will the annoyances never end?

Caution: This tip involves manipulation of the file system. While not inherently dangerous, care should be taken when dealing with the file system.

This little trick utilizes a little known feature of the NTFS file system. Users of Unix-like systems will be more familiar with it, but us Windows folk are just cluing into it.

Whenever you see a file in Windows Explorer, you're not actually looking at the file. You're looking at a little stub that points to where the file data is physically stored on the hard drive. That is called a hard link.

It's possible for a particular file to have many hard links pointing at it, that is to say: more than one hard link can point to the same spot on your hard drive.

Trouble is, there is no way to make new hard links through the Windows GUI. One must use the command line (though I'm working on a little tool that will allow creation through a friendlier GUI. Check back to see if I finished it.)

Here's what you do:

1. Open up the command shell (Start->Run type cmd then enter)
2. At the command line, type fsutil hardlink create NewFilename ExistingFilename (where NewFilename is the name of the new hard link and ExistingFilename is the name of the file that you want to point to)
Like this:

CODE
fsutil hardlink create MyNewLink.txt MyExistingLink.txt


A few caveats:

1. Hard links cannot span volumes. That means that they can only point to files on the same drive or partition.
2. If you create a hardlink to a file and then delete the original file, the file still exists. In order to delete a file you must delete all hardlinks that point to it.

Additional Reading:
http://www.microsoft.com/resources/documen...k.mspx?mfr=true
http://en.wikipedia.org/wiki/Hard_link


--------------------
Go to the top of the page
 
+Quote Post
Damaru
post Jan 2 2008, 02:47 AM
Post #2


Member
**

Group: Members
Posts: 43
Joined: 26-December 07
Member No.: 178,881



Hi Andrew,

I read through your post several times and looked at the pages at both of the links you provided, but I'm still a little confused...

Would the 3 different instances of the `My Documents' folder occuring in the WE tree-list be examples of 3 different hard links to the same data?

This post has been edited by Damaru: Jan 2 2008, 03:37 AM
Go to the top of the page
 
+Quote Post
Amazing Andrew
post Jan 2 2008, 03:10 PM
Post #3


Bleepin' Night Watchman
******

Group: BC Advisor
Posts: 1,762
Joined: 5-December 05
From: The City of Saint Francis, by the western sea
Member No.: 43,307



Now I'm a little confused. I'm not sure what you mean by "3 different instances of the `My Documents' folder occuring in the WE tree-list". Could you elaborate?


--------------------
Go to the top of the page
 
+Quote Post
Damaru
post Jan 2 2008, 10:38 PM
Post #4


Member
**

Group: Members
Posts: 43
Joined: 26-December 07
Member No.: 178,881



"Could you elaborate?"

My understanding is that the Windows XP folder structure contains 3 different instances of the `My Documents' folder (i.e., the same data is presented to the user in three different locations in the Windows Explorer folder-tree (at least two of which do not represent its real location in memory and thus constitute a level of abstraction between the user and his or her hard drive)).

My question was whether these 3 instances of the same folder are in fact `hard links' of the kind you described above.

This post has been edited by Damaru: Jan 3 2008, 01:08 AM
Go to the top of the page
 
+Quote Post
Amazing Andrew
post Jan 3 2008, 03:36 AM
Post #5


Bleepin' Night Watchman
******

Group: BC Advisor
Posts: 1,762
Joined: 5-December 05
From: The City of Saint Francis, by the western sea
Member No.: 43,307



Are you talking about how the My Documents folder can be accessed from a shortcut on the desktop, under "My Computer", as well as its actual location of C:\Documents and Settings\username\My Documents? If that's what your question, then no, that's a different (but similarly interesting) construct.


--------------------
Go to the top of the page
 
+Quote Post
Damaru
post Jan 3 2008, 07:23 AM
Post #6


Member
**

Group: Members
Posts: 43
Joined: 26-December 07
Member No.: 178,881



Yes, that is exactly what I was referring to. That is helpful to know, Andrew, thanks. smile.gif

My understanding (which is only tentative) is that the three instances of the `My Documents' folder are actually mirrors of each other (the real location being C:\Documents and Settings\username\My Documents as you rightly pointed out), and that, because of this, any changes made to the contents of one will automatically be reflected in the contents of the others.

My reason for asking about this construct and whether it had any relation to the `hard links' you described in your first post is because I've been looking for a way to reproduce the automatic synchronization that occurs across these three folders on my own. If there was a way for me to safely emulate this behavior, I was thinking it might enable me to access items stored in even the most deeply-buried folders on my computer in two clicks from the desktop.

By way of example, if I were to create a folder inside the Quicklaunch folder that mirrored the contents of a high-level folder like `My Computer' and then place that folder's Quicklaunch icon in the comma of the Quicklaunch bar (i.e. the part that is revealed by clicking the double-arrow or guillemot), all of that folder's sub-folders (as well as all of its sub-sub-folders and sub-sub-sub-folders, etc.) would become accessible via hover-activated flyout menus on the desktop.

With a halfway-decent knowledge of the Windows XP folder tree (and a cascading menu display setting that is optimized for one's personal mousing ability), this would provide most users with a way of getting at most any location on their computers as quickly (or more quickly) than any other commonly-available means.

Then again, there is probably already an app out there somewhere that provides precisely this functionality.

If anybody knows, please share!

This post has been edited by Damaru: Jan 3 2008, 09:08 AM
Go to the top of the page
 
+Quote Post
Damaru
post Jan 3 2008, 09:04 AM
Post #7


Member
**

Group: Members
Posts: 43
Joined: 26-December 07
Member No.: 178,881



As it turns out, I am an idiot! LOL hysterical.gif

After submitting that last post I went back and tweaked my toolbars a little bit and discovered that there is already an optimal solution to the `2-click universal folder access' problem built into the Windows XP GUI.

All you need to do is create a new toolbar on your desktop, detach it from your taskbar, drag it up to the top of your screen (where it should snap neatly into place), create a new `Desktop toolbar', drag it up so that it integrates into the first toolbar you created on the left-hand side, then expand the first toolbar to the left until no items are left on the visible part of the Desktop toolbar... When you're done, you should have a new combo-toolbar at the top of your screen with a drop-down menu on the left-hand side that will allow you to access any folder on your computer in two clicks from the desktop.

This post has been edited by Damaru: Jan 3 2008, 09:14 AM
Go to the top of the page
 
+Quote Post
Amazing Andrew
post Jan 3 2008, 03:03 PM
Post #8


Bleepin' Night Watchman
******

Group: BC Advisor
Posts: 1,762
Joined: 5-December 05
From: The City of Saint Francis, by the western sea
Member No.: 43,307



Those toolbars are very useful indeed! Did you know that you can drag pretty much any folder's icon to the edge of the screen to create a toolbar to that folder? It even works for special icons like "My Computer" and "My Network Places".


--------------------
Go to the top of the page
 
+Quote Post
Dialer
post Jan 3 2008, 03:22 PM
Post #9


Distinguished Member
*****

Group: Members
Posts: 642
Joined: 4-November 07
From: The Great State of Disarray
Member No.: 167,506



Thanks Damaru and Andrew! That's a great tip about dragging folders around to turn them into toolbars. I have made toolbars for the taskbar on occasion, but this is even cooler.


--------------------
Go to the top of the page
 
+Quote Post
Amazing Andrew
post Jan 10 2008, 04:56 AM
Post #10


Bleepin' Night Watchman
******

Group: BC Advisor
Posts: 1,762
Joined: 5-December 05
From: The City of Saint Francis, by the western sea
Member No.: 43,307



Here's the little app I promised: http://www.boredomsoft.com/Files/ntfshardlinker.html


--------------------
Go to the top of the page
 
+Quote Post
a55ess
post Feb 25 2008, 01:16 PM
Post #11


New Member
*

Group: Members
Posts: 1
Joined: 25-February 08
Member No.: 192,498



thumbup.gif thanx guys... i'm a newbie..
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



Lo-Fi Version Time is now: 4th July 2008 - 03:39 PM


Advertise   |   About Us   |   Terms of Use   |   Privacy Policy   |   Contact Us   |   Site Map   |   Chat   |   Tutorials   |   Uninstall List
Discussion Forums   |   The Computer Glossary   |   Resources   |   RSS Feeds   |   Startups   |   The File Database   |   Malware Removal Guides

© 2003-2008 All Rights Reserved Bleeping Computer LLC.