Is it possible to create a custom temporary explorer folder?

i'm working on a shell program that helps organizing files by custom categories and tags; Ideally all the files will be thrown in a common folder, and the program allows the user to get a list of files (in form of full path of just file name, since the folder is common).

Is there any way to then show up a temporary explorer window which has a defined list of files, so then the user can do everything you can normally do? (open files, copy, whatever).

For instance, when you use the search box in explorer you end up with a list of files which are not all in the same location; that's the result i'm looking for but i've no idea if it's possible and how.
@kbw how does that relate to my question? I need a temporary folder with existing files, not a temporary file.
barnack, am I correct in saying you want the built-in File Explorer (explorer.exe) to present a saved list of files to the user, on command? (In the same way that the search function of explorer.exe shows them)

If so, I don't think there is an exact solution to this, if we are limited to using explorer.exe.

However, you might be able to get close enough to what you want to do with a bit of experimenting. This resource may be able to help you:

When you perform a search in the File Explorer, and then click on the Search tab, you should see an option to "Save search". Save this file somewhere -- it is a ".search-ms" XML file that you can view on a program like Notepad++.

You'll see a part of the XML structure that shows <condition type="leafCondition" ...>
Instead of making it a leafCondition, make it an orCondition. Experiment with this using multiple or conditions to specify each file you want to show.

When you're done editing the file, double-click in the normal way to launch explorer.exe with the search query. I haven't tested this. It might not be fine-grained enough to do exactly what you want.

Edit: I might have found something even better for you, but I've only skimmed the surface
In Windows 7, the concept of virtual folders has been significantly realized with the introduction of the Libraries feature. Similar to Saved Searches, a Library is simply an XML file but with the .library-ms extension and is essentially a collection of files with specified attributes presented in a familiar folder-style visual interface. Libraries have a shell namespace extension in Explorer and their XML files can be reused across Windows installations or the network.
Last edited on
@kbw how does that relate to my question?
You can create a directory with the name that's generated.

If you want to be spoon fed, maybe someone else can help.
It looks like the .library-ms files might be exactly what's he's looking for, but I haven't tested it out.

kbw, true, as an alternative, what he could do is create the directory, and populate it programmatically with shortcuts to the actual files. The shortcuts could be thought of as "pointers". Then open that folder in explorer.exe
Last edited on
@kbv an application of what i'm making would be helping users to extract certain files out of big folders; imagine trying to filter out of all your pictures the ones that under setting category contain mountains, or filtering all music files which under instruments contain piano. Creating a temporary file for each file in a new location and opening that folder is just excessively heavy and pointless. Would you make a copy of your search results everytime you run a search?

@Ganado indeed that virtual folder is exactly what i'm looking for, because it solves all problems, no pointless copies needed, and then i can open it with default explorer, thanks!
in case someone ends up in this topic, since there's very little on the internet about creating custom libraries via code (unfortunatelly, it would be nice to have some sample to start from), there's always the option of playing with the hidden attribute of the source folder.
Topic archived. No new replies allowed.