11

I have saved a HTML web page. I got a .html file along with a folder which has the same name. Both of these seem to be linked magically:

  • if I delete the HTML file, the folder gets deleted as well
  • if I delete the folder, the HTML file gets deleted as well

The question is 2-fold:

  1. how do I delete the folder without deleting the HTML file?
  2. how does that technically work? How does Windows or NTFS perform the necessary linking?

I'm on Windows 7 SP1 x64, all updates. The files were saved using Firefox 61.0.1. However, on the disk, it's shown as a "Chrome HTML Document".

Thomas Weller
  • 5,704
  • 11
  • 55
  • 100
  • You cannot they are linked and will not work independently of each other. – Moab Jul 09 '18 at 20:51
  • If you make copies of both, are they still linked? – InterLinked Jul 09 '18 at 20:58
  • 2
    See here: https://stackoverflow.com/questions/34717448/reason-why-folder-associated-with-saved-webpage-gets-deleted-when-we-delete-save and https://answers.microsoft.com/en-us/windows/forum/windows_10-files-winpc/delete-html-file-without-deleting-resource-files/295d8767-b6fa-4e65-ad87-ff8bae659811 – wysiwyg Jul 09 '18 at 22:21
  • 2
    @Moab: I edited the HTML file so that it does not need files. – Thomas Weller Jul 09 '18 at 22:31

1 Answers1

11

How do I delete the folder without deleting the HTML file?

Explorer

Rename the folder before deleting it. This includes:

  • Removing the _files portion of the name at the end of the folder.

  • Renaming some portion of the main folder name (i.e. what comes before _files).

  • Changing the folder name all together.

Command Prompt

You can use something like e.g.:

rmdir "example-html-dir_files" /s

Note that this will prompt you to confirm removal of the directory. Since some pages are saved with long titles, you can optionally use dir /x to get the DOS 8.1 short name for the directory ahead of time (as needed).

How does that technically work? How does Windows or NTFS perform the necessary linking?


Warning: Suppositions Ahead!

Note, however, this Super User answer for Windows XP (provided helpfully in the comments) seems to confirm this behavior is based around Explorer itself. This StackOverflow answer indicates this behavior has been around since Windows 2000 and applies to (at least) Copy, Cut, Paste, Move, Delete and Send To.


While this is admittedly a guess, it seems that this behavior may be something specific to Explorer.

As evidence, these files/folders only seem linked in Explorer (they aren't apparently linked on the command line) and are only "linked" if they:

  1. Have (relatively speaking) the exact same names.

  2. End with some combination of .htm, .html (for files) or _file, _files (for folders).

Furthermore, it seems possible to rename any file with e.g. .htm, create a new folder with the same name with e.g. _files at the end and they will then apparently exhibit the same "linked" behavior automatically (e.g. deleted together, etc).

The files were saved using Firefox 61.0.1. However, on the disk, it's shown as a "Chrome HTML Document".

It sounds as if Chrome is set as your default browser and is associated with .htm and .html files.

Anaksunaman
  • 16,718
  • 4
  • 38
  • 45
  • 7
    It’s called “_file connection_.” A Windows-specific (or probably `explorer.exe`-specific) feature. [Here’s the document.](https://docs.microsoft.com/en-us/windows/win32/shell/manage#connected-files) – Константин Ван Jul 12 '19 at 08:19
  • 1
    It's proper BS that it can't be changed in the settings of either file or directory. – Robin De Schepper Nov 02 '19 at 11:30
  • 1
    @RobinDeSchepper Honestly, I have never understood the reasoning behind not having an option. It seems like common sense to me, too. – Anaksunaman Nov 02 '19 at 11:41
  • 2
    It actually does have an option. It's documented in the link Константин Ван sent: by creating and setting to 1 the REG_DWORD at HKEY_CURRENT_USER/SOFTWARE/Microsoft/Windows/CurrentVersion/Explorer/NoFileFolderConnection – Angivare Nov 01 '21 at 17:06
  • 1
    Good point. But by option, personally, I meant e.g. a simple toggle in the UI. It's worthwhile knowing Microsoft allows this association to be disabled, but digging around in the registry for a value that doesn't normally even exist probably hides this fact from many users. – Anaksunaman Nov 01 '21 at 20:51