53

I saved a webpage in my browser as HTML. It saved not only a HTML file, but also a directory with various image files and whatnot.

So I deleted the dir, since I only wanted the HTML file.

Windows deleted the HTML file anyway.

I assumed that I had both selected, so I restored them from the trash can and very specifically selected only the HTML file. Delete. Both deleted.

I restored them once again and tried to move the dir to the trash can. The HTML file was deleted again.

Somehow, Windows (10) has "coupled" these internally somehow, refusing to let me move or delete them individually. Extremely annoying.

I ended up deleting them and then restoring only the HTML file from the trash can. It didn't restore the dir in that situation, at least. But that's a ridiculous thing to have to do.

Why does it do this in the first place? I didn't know it could do this at all.

A Rocque
  • 539
  • 3
  • 3
  • 2
    The HTML file and directory go hand in hand since the directory contains content for the HTML file - deleting one will delete the other when saved in that format. There should be an option for just a single HTML page, possibly `.mhtml` or something similar - check the drop down menu for the file extension in the Save Dialog. – JW0914 Jun 18 '22 at 21:53
  • 7
    This is not a direct answer to your question, but does explain the behaviour described, and how to disable it: https://superuser.com/questions/103280/removing-file-folder-link-after-using-save-as-then-web-page-complete – MiG Jun 18 '22 at 22:08
  • 3
    Does this answer your question? [Windows deletes HTML files when I delete a folder](https://superuser.com/questions/1337772/windows-deletes-html-files-when-i-delete-a-folder) – phuclv Jun 19 '22 at 12:31
  • 1
    duplicates: [How to delete the "_files" folder?](https://superuser.com/q/907772/241386) [How do I unlink a file-folder relationship?](https://superuser.com/q/153106/241386), [Windows deletes HTML files when I delete a folder](https://superuser.com/q/1337772/241386), [How to prevent Windows file explorer from automatically linking a .html (or .htm) file to a similarly named folder? (Connected Files in File Explorer)](https://superuser.com/q/1440406/241386), [How to break Windows Explorer connection between HTML file and its directory?](https://superuser.com/q/1139497/241386) – phuclv Jun 19 '22 at 12:33
  • You don't say which browser you used, but Chrome, Firefox, and Edge all have both "html Complete" (which saves the whole page with the folder as you found out) and "html only" (which saves just the html). – Martin Argerami Jun 20 '22 at 18:18
  • Does this answer your question? [Removing file / folder link after using "Save As..." then "Web Page, complete"](https://superuser.com/questions/103280/removing-file-folder-link-after-using-save-as-then-web-page-complete) – David Z Jun 22 '22 at 03:16
  • That's the one I posted above @DavidZ! Considering the crazy number of upvotes the answer below got, perhaps I should have poured it into an answer... – MiG Jun 22 '22 at 08:14
  • @MiG I think the best thing to do would have been to flag it as a duplicate. That's what I did (more or less), and the system automatically generated a comment linking to the duplicate target - I didn't post that comment manually. Sorry about that! – David Z Jun 22 '22 at 17:02

1 Answers1

45

Why does it do this in the first place?

Because Windows Explorer (specifically) is set up to associate any items with an .htm or .html extension with any folder with a _file or _files extension, assuming that they have the same basic file name (e.g. example.htm and example_file).

Notes

  • Items are related by file name only. Alterations to the names (e.g. removing _file or _files after the folder name) will stop Explorer from treating them as a pair.

  • I am unaware of any easy way to adjust this association, such as via a Windows Explorer setting or toggle.

  • Operations run from the command line shouldn't run into this association issue.

Anaksunaman
  • 16,718
  • 4
  • 38
  • 45
  • 3
    There is an option in "Folder Settings" to disable this association. (Or at least used to be; the corresponding registry key would still work in any case.) – u1686_grawity Jun 19 '22 at 07:35
  • 19
    `I am unaware of any easy way to adjust this association` - check https://superuser.com/a/103773/519577 – hanshenrik Jun 19 '22 at 09:21