Associating/Grouping a file with a folder in Windows so that they both are moved together
Solution 1:
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.