GP SoftwareTwitter
Opus FAQsManualCommandsObjects

Find folders that do not have a specific file?


I would like to find all folders that DO NOT have a specific file. I tried some things, but gave up.

Select folders which (sub)folder(s) contains certain file?

It can be done but would require some scripting.

We can help with some more detail:

  • What’s the filename you want to check for?
  • If folder A doesn’t contain the file directly below it, should it then look in other folders below it, or stop straight away?
  • If A doesn’t have the file, but A\B does contain the file, do you want A to be included or excluded?

  1. filename is FolderArt.xmv
  2. No, there won’t be any
  3. Assuming this is dependant on #2? If yes, this doesn’t matter then.



Download this and drop it into the list in Preferences / Toolbars / Scripts:

You can then use it like this:

Script code for reference:

// Called by Directory Opus to initialize the script
function OnInit(initData)
{ = "HasFolderArt";
	initData.version = "1.0";
	initData.copyright = "(c) 2018 Leo Davidson";
	initData.url = "";
	initData.desc = "Adds a column that says if a folder contains a FolderArt.xmv file, which can be used for searching.";
	initData.default_enable = true;
	initData.min_version = "12.0";

	var col = initData.AddColumn(); = "HasFolderArt";
	col.method = "OnHasFolderArt";
	col.label = "Has Folder Art";
	col.justify = "left";
	col.autogroup = true;

// Implement the HasFolderArt column
function OnHasFolderArt(scriptColData)
	if (!scriptColData.item.is_dir)
		scriptColData.value = "";

	if (DOpus.FSUtil.Exists(scriptColData.item.realpath + "\\FolderArt.xmv"))
		scriptColData.value = "Yes";
		scriptColData.value = "No";

Select folders with a folder picture

Wow. That is above and beyond. Will try it out. Thanks @Leo!


Works like a champ! Thanks again. Save me a few hours.


Nice solution @Leo.

This kind of thing comes up every now and then. Would make a good generic script.

For when using a filter could we update it to accept a match string to the script column?

This would make mean the column does not work as a normal column. But would add some value in this scenario.


I don’t think script columns can do that. They aren’t told what the filter is looking for.


Might be a useful addition to support something like this.


For anyone finding this thread, here's a related thread which has some other methods of doing similar things.

The script I posted above is a good solution for some tasks, but the ones in the other thread may suit you better, depending on exactly what you need to do.