Windows deletes HTML files when I delete a folder [duplicate]

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.