Associating/Grouping a file with a folder in Windows so that they both are moved together

10

5

I saved an HTML web page using Google Chrome. An HTML file along with a folder containing the images was saved on my computer. Now when I move the HTML file to a different location or delete it, the folder moves along with it.

How is this association enforced?

I am seeing this behavior on Windows. Is it something specific to NTFS? Can it also be achieved on Linux?

Rohit Banga

Posted 2011-01-28T18:16:19.760

Reputation: 1 814

Possible duplicate: http://superuser.com/q/41200/302

– Rowland Shaw – 2011-02-09T09:00:13.477

Answers

18

This is specific to the Windows shell, and applies only to .htm and .html files. If you'd moved the file from a Command Prompt, the associated folder would stay in place. In Windows XP, this behavior is controllable via Tools -> Folder Options in an Explorer window (or the Folder Options icon in the Control Panel). On the View tab, under Advanced settings is a group of options labeled "Managing pairs of Web pages and folders".

The GUI option to change this behavior appears to be gone from Windows 7; I'm not sure about Vista.

The feature can be managed via the registry. The key HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer, DWORD value NoFileFolderConnection. Disable the feature by setting the value to 1. Re-enable the feature by setting the value back to 0 or deleting the value altogether.

The feature itself is called Connected Files, and a reference is available at this MSDN page.

To extend this feature beyond just HTML pages and their associated folders, you'd have to implement everything yourself. SHFileOperation already has special support for connected files, but there doesn't seem to be any means by which to extend it.

Since the feature is shell-dependent, it'd have to be recreated in the file managers in Linux.

afrazier

Posted 2011-01-28T18:16:19.760

Reputation: 21 316

1I am using Windows 7. And there must be a way to establish it programatically as Google Chrome is doing it for the saved HTML files. – Rohit Banga – 2011-01-29T04:49:09.307

6@iamrohitbanga: Nope -- it's driven entirely by the file/folder names. Updated my answer with more information and references. I'm curious what the downvote was for though, for whomever did that. – afrazier – 2011-02-09T18:07:00.170