Display mode by detecting content of subdirectories

This is what i'm trying to achieve:

  • I want my default file display mode set to 'tiles', for instance.
  • When I enter a directory that contains no images itself, but that contains only subdirectories with images, I would like the file display mode to automatically change to thumbnail mode. So, this way, I can already see the contents of the subdirectories by means of folder thumbnails.

So, it's a bit like 'content type formats', but it has to happen one directory sooner.

Is there a wildcard path format or a script that I could use to detect the presence of .jpg files in subdirectories?

Thanks in advance!

Wildcard path formats could do it for particular directories (or directories above/below particular directories), but they can't match files in directories.

A script could do it, but I'm not sure how the performance would be. Every time you changed folders, it would have to read the list of files in each sub-folder to see what was in them, and then issue a command to change the view mode, which could change underneath you a second or two later in a large folder.

The script idea might work if it only checks the first few files and doesn't do a full listing of the sub-folders, but I imagine that would lead to fairly random results.

Using wildcard path formats is probably best if you have things organised in a structure so all the folders you want to act differently are at a common level in the hierarchy.

Ok, I will try that. Thank you!