<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>How do I find the original name of a hard link?</title><link>http://blogs.msdn.com/b/oldnewthing/archive/2011/07/20/10188033.aspx</link><description>Once you ask the right question, the answer is FindFirstFileName.</description><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>re: How do I find the original name of a hard link?</title><link>http://blogs.msdn.com/b/oldnewthing/archive/2011/07/20/10188033.aspx#10189611</link><pubDate>Mon, 25 Jul 2011 18:54:46 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10189611</guid><dc:creator>David Walker</dc:creator><description>&lt;p&gt;@LR: The simple sum over all DIRECTORY sizes, which is easy to get from Explorer, will often overestimate the total amount of space required. &amp;nbsp;The reported size of WinSXS includes files that are hard-linked from inside WinSXS, but the files exist elsewhere. &amp;nbsp;Those file sizes are also counted in the &amp;quot;size&amp;quot; of the other directories.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10189611" width="1" height="1"&gt;</description></item><item><title>re: How do I find the original name of a hard link?</title><link>http://blogs.msdn.com/b/oldnewthing/archive/2011/07/20/10188033.aspx#10189609</link><pubDate>Mon, 25 Jul 2011 18:51:54 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10189609</guid><dc:creator>David Walker</dc:creator><description>&lt;p&gt;@pls fix: &amp;nbsp;If you want a copy of everything that&amp;#39;s referenced in a folder (including everything that is the ultimate target of hard links), then you DO, in fact, need to copy the contents of things that are hard-linked. &amp;nbsp;Your obstinance doesn&amp;#39;t change this. &amp;nbsp;You might be copying across a network, or to an external disk that will be detached from the computer or network and carried somewhere else. &amp;nbsp;We can agree to disagree. &amp;nbsp;&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10189609" width="1" height="1"&gt;</description></item><item><title>re: How do I find the original name of a hard link?</title><link>http://blogs.msdn.com/b/oldnewthing/archive/2011/07/20/10188033.aspx#10189442</link><pubDate>Mon, 25 Jul 2011 13:35:10 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10189442</guid><dc:creator>LR</dc:creator><description>&lt;p&gt;@Gabe,&lt;/p&gt;
&lt;p&gt;right. But because of differential backups, the size that a backup will take is a really complicated matter (where hardlinks only play a very minor part, in my opinion).&lt;/p&gt;
&lt;p&gt;Everytime when you delete something which shares a large amount of files via hardlinks with other directories, I would think that you have some special case. How often do you delete /bin, /user/bin, /lib etc, and have checked the size of this directories with the Linux pedant of the Explorer first?&lt;/p&gt;
&lt;p&gt;For the most usual cases (copying something to USB or network or another volume), the size displayed in Explorer is right.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10189442" width="1" height="1"&gt;</description></item><item><title>re: How do I find the original name of a hard link?</title><link>http://blogs.msdn.com/b/oldnewthing/archive/2011/07/20/10188033.aspx#10189406</link><pubDate>Mon, 25 Jul 2011 12:08:57 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10189406</guid><dc:creator>Gabe</dc:creator><description>&lt;p&gt;LR: Another situation you need to consider is &amp;quot;How much additional free space will my disk have if I delete this folder?&amp;quot;&lt;/p&gt;
&lt;p&gt;Of course you probably don&amp;#39;t want to delete WinSxS but it&amp;#39;s very similar to &amp;quot;How much space will this folder use on my backup tapes, assuming the rest of the disk is already backed up?&amp;quot; if your backup program knows about hard links.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10189406" width="1" height="1"&gt;</description></item><item><title>re: How do I find the original name of a hard link?</title><link>http://blogs.msdn.com/b/oldnewthing/archive/2011/07/20/10188033.aspx#10189375</link><pubDate>Mon, 25 Jul 2011 09:47:54 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10189375</guid><dc:creator>LR</dc:creator><description>&lt;p&gt;@Pls fix, Joshua:&lt;/p&gt;
&lt;p&gt;The meaning of &amp;quot;correct folder size&amp;quot; depends entirely of what you want to get from this value. The only situation in which a simple sum over all files sizes is incorrect occurs when all of this three conditions are true:&lt;/p&gt;
&lt;p&gt;- You want to copy the directory, and the copy tool is taking hardlinks into account by recreating the situation (references to the same file) at the target directory. &lt;/p&gt;
&lt;p&gt;- You are not copying to a FAT(32) volume or some sort of network folders. Note that USB sticks use FAT(32) most of the time. (Yes, you can reformat them to NTFS. I know this, and have done this myself.)&lt;/p&gt;
&lt;p&gt;- The directory (including its subdirectories, if you are planning to perform a recursive folder copy) contains two or more references to the same file. (References shared with folders *outside* of the actual source directory must not get special handling, of course. This files must be copied to the target as usual.)&lt;/p&gt;
&lt;p&gt;Only all three conditions together make the simple sum invalid, but how can the Explorer know what are trying to do?&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10189375" width="1" height="1"&gt;</description></item><item><title>re: How do I find the original name of a hard link?</title><link>http://blogs.msdn.com/b/oldnewthing/archive/2011/07/20/10188033.aspx#10189280</link><pubDate>Sun, 24 Jul 2011 20:48:02 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10189280</guid><dc:creator>Joshua</dc:creator><description>&lt;p&gt;I&amp;#39;d assume that Pls fix is also from a Unix background, but has forgotten that most windows tools (including Explorer&amp;#39;s folder copy) fail to gather hard links across folder copies.&lt;/p&gt;
&lt;p&gt;I have a tool that correctly does the copy and another tool that correctly determines the size. See &lt;a rel="nofollow" target="_new" href="http://www.cygwin.com"&gt;http://www.cygwin.com&lt;/a&gt;.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10189280" width="1" height="1"&gt;</description></item><item><title>re: How do I find the original name of a hard link?</title><link>http://blogs.msdn.com/b/oldnewthing/archive/2011/07/20/10188033.aspx#10189116</link><pubDate>Sat, 23 Jul 2011 06:23:47 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10189116</guid><dc:creator>Pls fix</dc:creator><description>&lt;p&gt;@David Walker, the correct size is and always be the size excluding the redundant hard links and all other sort of redundant junction points. Just freaking count them only once. The size including the hard links is the total gross size which is incorrect and what Explorer currently shows.&lt;/p&gt;
&lt;div class="post"&gt;[&lt;i&gt;I find your confidence in the use of the word &amp;quot;always&amp;quot; refreshingly idealistic. -Raymond&lt;/i&gt;]&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10189116" width="1" height="1"&gt;</description></item><item><title>re: How do I find the original name of a hard link?</title><link>http://blogs.msdn.com/b/oldnewthing/archive/2011/07/20/10188033.aspx#10188973</link><pubDate>Fri, 22 Jul 2011 15:29:14 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10188973</guid><dc:creator>David Walker</dc:creator><description>&lt;p&gt;@640k: What I said WAS true, modulo any sector overhead. &amp;nbsp;It also may depend on whether you are copying to a different folder on the same disk, or to a different disk. &amp;nbsp;Copying onto a different disk or to tape will copy all of the data from the WinSXS folder. &amp;nbsp;Copying on to the same disk might just copy the hard links -- I&amp;#39;m not sure about that. &amp;nbsp;So the size reported by Explorer for WinSXS *is* correct.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10188973" width="1" height="1"&gt;</description></item><item><title>re: How do I find the original name of a hard link?</title><link>http://blogs.msdn.com/b/oldnewthing/archive/2011/07/20/10188033.aspx#10188860</link><pubDate>Fri, 22 Jul 2011 08:31:31 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10188860</guid><dc:creator>640k</dc:creator><description>&lt;p&gt;@Adam Rosenfield: But aside from backup programs, what are the possible use cases for wanting to enumerate the hard links to a given file?&lt;/p&gt;
&lt;p&gt;Most common case is probably when deleting an open file.&lt;/p&gt;
&lt;p&gt;@David Walker: There is not a &amp;quot;correct&amp;quot; answer. &amp;nbsp;The reported size of the Winsxs folder is, in fact, the correct amount of space you&amp;#39;ll need if you copy all of the file data that is pointed to by filenames that are in the Winsxs folder.&lt;/p&gt;
&lt;p&gt;This is obviously not true because the files in Winsxs takes different amount of space if copying to ntfs or fat.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10188860" width="1" height="1"&gt;</description></item><item><title>re: How do I find the original name of a hard link?</title><link>http://blogs.msdn.com/b/oldnewthing/archive/2011/07/20/10188033.aspx#10188799</link><pubDate>Fri, 22 Jul 2011 01:13:44 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10188799</guid><dc:creator>Anonymous</dc:creator><description>&lt;p&gt;@Bob&lt;/p&gt;
&lt;p&gt;I am finding this FindLinks tool quite useless. &amp;nbsp;Such a tool is already built into the OS:&lt;/p&gt;
&lt;p&gt;To list links:&lt;/p&gt;
&lt;p&gt;&amp;gt; fsutil hardlink list C:\windows\notepad.exe&lt;/p&gt;
&lt;p&gt;To query the file index:&lt;/p&gt;
&lt;p&gt;&amp;gt; fsutil file queryfileid C:\windows\notepad.exe&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10188799" width="1" height="1"&gt;</description></item></channel></rss>