Home | Games | Awards | About | Blog | Press Kit | Contact
How Connected Files are Made, and their Problems
Friday, July 16, 2004
By: Jason Doucette

Have you ever used the File -> Save As... selection in Internet Explorer?  You can use this to save an entire webpage to your hard drive, including all of the images required for it to display properly; not just the .html files.  Select 'Web Page, complete (*.htm; *.html)' for the 'Save as type:' selection, and an HTML file with the name of the web page's title will be saved, with a folder similarly named that contains all of the web page's contents.  Do this for the page you are viewing now, and save it to the Desktop, and have a look.

Now delete just the .html file.  What happens?

The folder disappears, as well.  This is what Microsoft calls 'Connected Files'.

You must be very careful when managing a connected file, because whatever you do to the file or the folder determines the fate of both of them.  If you are a user that presses 'Shift + Delete' often (to immediately delete a file, without retiring it to the Recycle Bin first), then doing so on the .html file will also delete, without chance of restoration, the folder with all of the images, as well.

True story:  Some guy created a webpage by starting with the HTML code of another site by using this 'Save As...' feature.  After he was satisfied with his changes, he deleted the useless folder of images.  He used Shift + Delete because he know he had no use whatsoever for the images folder.  Bang!  His work was deleted with it, with no chance of recovery.  This is one reason to be aware of how connected files work.  (And, it is also a reason to never use Shift + Delete, especially not regularly, because it becomes habit.  Use the Recycle Bin.  It's there for a reason.  It doesn't slow your computer down.  And you just never know when you may want something restored.)

 

Technical Details

So, what kind of fancy magic is going on behind the scenes to connect files and folders together?  After all, looking at the properties of each does not reveal anything unusual.  I finally found an MSDN page on the SHFileOperation function that describes it.  I will quote the relevant blurb of text here, since it is unlikely that any non-programmer wishes to read the rest of it:

Connecting Files

With Microsoft® Windows® 2000 or later, it is possible to connect an HTML file with a folder that contains related files such as Graphics Interchange Format (GIF) images or style sheets. If file connection is enabled, when you move or copy the HTML file, the folder and all of its files are moved or copied as well. Conversely, if you move the folder with the related files, the HTML file is also moved.

The HTML file must have a .htm or .html extension. You create the connection to the related files by placing the folder that contains them into the same folder as the HTML file. The name of the folder that contains the connected files must be the same as the name of the HTML file followed by "_files" or ".files" (this is case sensitive; for example, ".Files" does not work). An example is given here.

1. Create a file named Test.htm in the C:\Files directory (C:\Files\Test.htm).
2. Create a new folder named Test.files in the C:\Files directory (C:\Files\Text.files).
3. Populate the folder with a few files. Any file placed in this folder is connected to Test.htm.
4. Move or copy the Test.htm file to the C:\Files2 directory.
5. Note that the Test.files directory is now found in the C:\Files2 directory as well.

File connection is enabled by default. It can be disabled by adding a REG_DWORD value, NoFileFolderConnection, to this registry key.

HKEY_CURRENT_USER -> Software -> Microsoft -> Windows -> CurrentVersion -> Explorer -> NoFileFolderConnection

Setting NoFileFolderConnection to 1 disables file connection. If the value is set to zero or is missing, file connection is enabled.

 

About the Author: I am Jason Doucette of Xona Games, an award-winning, indie game studio that I co-founded with my twin brother. We make arcade-style intense retro games. Our business, our games, our technology, and we as competitive gamers have won prestigious awards and received worldwide press. Our business has won $180,000 in contests. Our games have won contests, have ranked from #1 in Canada to #1 in Japan, have become #1 best sellers in multiple countries, and held 3 of the 5 top rated spots in Japan out of all indie games on Xbox LIVE. Our game engines have been awarded for technical excellence. And we, the developers, have placed #1 in competitive gaming competitions relating to the games we make. Read about our story, our awards, our games, and view our blog.


Email:
Xona Games, Xona.com, Xonatech, Saw Tooth Distortion, Evolutionary Prototype (EP), Duality ZF, Decimation X, Decimation X2,
Decimation X3, Decimation X3.5, Decimation X4, Score Rush, Score Rush 2, and Score Rush MP
trademarked and copyrighted by Xona Games Inc., Jason Doucette, and/or Matthew Doucette.
© 2000..2005 Saw Tooth Distortion
© Xona.com
© Xona Games Inc.
We make Intense Retro games.