hardlink

What is the difference between a symbolic link and a hard link?

Recently I was asked this during a job interview. I was honest and said I knew how a symbolic link behaves and how to create one, but do not understand the use of a hard link and how it differs from a symbolic one. ...

fsutil hardlink doesn't work?

I was looking for a way to create hard links under Windows and I found this page: http://technet.microsoft.com/en-us/library/cc788097.aspx To try it out, I created a file (1.txt) on the root of my C: drive with 100 lines of the following content: C:\1.txt (2.598 bytes): test test test test test Then I open the command prompt and typ...

Find out whether a file is a symlink in Powershell

Edit: Changed the question title since the answer explicitly only handles Symlinks. I am having a Powershell script which is walking a directory tree and sometimes I have auxiliary files hardlinked there which should not be processed. Is there an easy way of finding out whether a file (i. e. System.IO.FileInfo) is a hard link or not? I...

Using hardlinks when cloning a Mercurial repository under Windows

I am using Mercurial under Windows XP (using the TortoiseHg distribution) and I want to use NTFS hardlinks when cloning a repository. Out of the box Mercurial does not do this. I have read that a win32file python extension needs to be enabled. So far I have been unsuccessful in making this work (adding a win32file entry to the extensions...

How to create a Hardlink using the New-Hardlink PowerShell PSCX command

I want to create a new Hardlink with the PowerShell Community Extensions PSCX commandlet New-Hardlink http://pscx.codeplex.com/. I have read the man file and tried almost every combination of commands but it won't work. What am I missing? (I know about fsutil, but I want to use this commandlet/alias) Here is the directory structure: E:...

NFS + Hard Links?

I know it is a condition of hard links that they cannot span filesystems. Does this apply to NFS mounts? Given the following directory structure, would I be able to create a hard link in directory A that points to a file in directory B? /root     /A     /B <-NFS mount For example, I'd like to run " ln /root/b/file.txt /root/a/linked...

Creating directory hard links in MacOS X?

How can I create a hard link to a directory in OSX? This feature has been added to their file system in 10.5 (for time machine), but I could not find any information on actually using it from the command line. ...

Deduplicating identical files using hard links

I have a couple of identical files stored in more than one place on my hard disk. I figure I can save a lot of disk space by hard-linking them to point to the same file. I am a little worried about possibly disastrous side effects. I guess it does not affect permissions, as those are stored in the respective directories, just like the f...

How to find all files which are basically soft or hard links of other directories or files on linux?

How could I get the list of all linked files on my system or from a certain directory. I used to create links but they became unmanageable with time. I want the list of all such links from a directory. Can anyone help? ...

How to get hardlink cloning on Windows

I've got a Win7 x64 box running Tortoise 1.0 x64 release. About Tortoise reveals that it's 1.0 "with Mercurial-1.5, Python-2.6.4, PyGTK-2.16.0, GTK-2.18.7". I've also got ActivePython 2.6 and Mercurial 1.5 x64 installed (installed via the Mercurial installer from the 64-bit installer. Neither one clone with Hard Links on my windows box. ...

replace file with hardlink to another file atomically

I have two directory entries, a and b. Before, a and b point to different inodes. Afterwards, I want b to point to the same inode as a does. I want this to be safe - by which I mean if I fail somewhere, b either points to its original inode or the a inode. most especially I don't want to end up with b disappearing. mv is atomic when ove...

Hard link and Symbolic links in Unix

Hi All, I just wanted to clarify if a hard/symbolic link is actually a file that is created ?? I ran the command: ln source hardlink ln -s source softlink -- The ls command shows this 2 links as a file. So my query is, does ln / ln -s actually create a file? Regards, darkie15 ...

Delete link to file without clearing readonly bit

I have a set of files with multiple links to them. The files are owned by TFS source control but other links to them are made to them. How do I delete the additional links without clearing the readonly bit. It's safe to assume: The files have more than one link to them You are not deleting the name owned by TFS There are no potential...

Get Windows hardlink count without GetFileInformationByHandle()

Hello, Is there a way to get a file hardlinks count on Windows without using GetFileInformationByHandle()? MSDN says: Depending on the underlying network features of the operating system and the type of server connected to, the GetFileInformationByHandle function may fail, return partial information, or full information for the giv...

How can I programmatically distinguish hard links from real files in Windows 7?

I have a difference between files size and used disk space (total file size is even more than disk size). I suppose because there are many hard links exist (to WinSxS components) in Windows 7/Vista. But how can I programmatically distinguish hard links from real files in Windows 7? ...

How to enumerate paths for all NTFS hard links pointing to a file?

I can use GetFileInformationByHandle to determine the number of hard links associated with a file. How can I enumerate the paths which make up those links? For example, if C:\TEMP_1.BIN and C:\TEMP_2.BIN are hard links to the same content, and I determine from GetFileInformationByHandle that C:\TEMP_1.BIN has nNumberOfLinks=2, how can I...